with various attributes to control styling and layout. The PHP code contains functions to perform arithmetic operations, string manipulation and nested loops to generate a chess board pattern.">,
,
,
with various attributes to control styling and layout. The PHP code contains functions to perform arithmetic operations, string manipulation and nested loops to generate a chess board pattern.">
The document contains code snippets demonstrating various HTML/CSS concepts like forms, tables, navigation bars etc. and PHP code to perform operations on strings, numbers and create a chess board using loops. The snippets show the use of tags like <form>, <table>, <ul>, <li> with various attributes to control styling and layout. The PHP code contains functions to perform arithmetic operations, string manipulation and nested loops to generate a chess board pattern.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
84 views39 pages
Sem 5 (WT)
The document contains code snippets demonstrating various HTML/CSS concepts like forms, tables, navigation bars etc. and PHP code to perform operations on strings, numbers and create a chess board using loops. The snippets show the use of tags like <form>, <table>, <ul>, <li> with various attributes to control styling and layout. The PHP code contains functions to perform arithmetic operations, string manipulation and nested loops to generate a chess board pattern.
<h1 style="background:yellow;color:red;text- align:center;font-family:Comic Sans MS">Infosys</h1><br> <p style="color:blue;border-style:dotted;border- color:black">Infosys Limited is an Indian multinational information technology company that provides business consulting, information technology and outsourcing services. The company was founded in Pune and is headquartered in Bangalore.[5] Infosys is the second-largest Indian IT company, after Tata Consultancy Services, by 2020 revenue figures, and the 602nd largest public company in the world, according to the Forbes Global 2000 ranking.[6]
On 24 August 2021, Infosys became the fourth Indian
company to reach $100 billion in market capitalization.</p> </body>
Enter first string :<input type='text' name='str1'><br>
Enter second string :<input type='text' name='str2'><br>
<input type=submit value=ok>
</form> </body>
<?php $s1=$_POST['str1']; $s2=$_POST['str2']; if(strpos($s2,$s1)) { echo "$s1 is present at begining at $s2<br>"; } else { echo "$s1 is no present at the begining of $s2<br>"; }
$z=strpos($s2,$s1); echo "position of $1 in $s2 is $z<br>";
SLIP NO.9 Q1. <html> <body> <form action=secondprog.php method=post> <label>Enter the string:*</label><br> <input type='text' name='string1'><br><br> <label>choice the separator:*</label><br> <select name="separator"> <option value="">[select]</option> <option value="#">#</option> <option value="%">%</option> <option value=",">,</option> <option value="!">!</option> </select><br><br> <input type='radio' name="choice" value=1>separate string<br> <input type='radio' name="choice" value=2>replace separator <!-- for replacement of separator we need another dropdownlist --> <select name="newsep"> <option value="">[select]</option> <option value="#">#</option> <option value="%">%</option> <option value=",">,</option> <option value="!">!</option> </select><br> <input type='radio' name="choice" value=3>Get the last word of String<br> <br><input type=submit value=ok> <br><input type=reset value=cancel> </form> </body> </html>
<?php $string1=$_POST['string1']; $separater=$_POST['separator']; $choice=$_POST['choice']; $new_separater=$_POST['newsep'];//only for second case echo"originonal String is=$string1.<br>";
switch($choice) { case 1:
$sep_string=explode($separater,$string1); echo"separated string is=>"; print_r($sep_string); break; case 2: $z=str_replace($separater,$new_separater,$string1); echo "replaced string is".$z; break; case 3:
print_r($a); echo "<br>ascending order sort by value<br>"; asort($a); print_r($a); echo "<br>ascending order sort by Key<br>"; ksort($a); print_r($a);
echo "<br>descending order sorting by Value<br>";
arsort($a); print_r($a);
echo "<br>descending order sorting by key<br>";
krsort($a); print_r($a);
?>
SLIP NO.18 Q1. <html> <body> <form action="seta1.php" method="POST"> 1.Reverse the order of each element’s key-value pair <input type="radio" name="opt1" value="o1"><br> 2.traverse the element in the random order <input type="radio" name="opt1" value="o2"><br> 3. Convert the array elements into individual variables. <input type="radio" name="opt1" value="o3"><br> 4.Display the elements of an array along with key. <input type="radio" name="opt1" value="o4"><br> <input type="submit" value="ok">
//Send data to the browser. &deg; is the ASCII code for the degree sign. echo "<p>The average high temperature for the month was $avg °F.</p>\n";
//Sort the temps and get the top and bottom five. //Use rsort to produce a descending sort. rsort($highTemps); //Pull out the top 5 temps. $topTemps = array_slice($highTemps, 0, 5); echo "<p>The warmest five high temperatures were: <br />\n"; foreach($topTemps as $t) { echo "$t °F <br/> \n"; } echo "</p>";
?>
SLIP NO.22 Q1. <html> <body> <form name="f1" method="POST" action="arrayc1.php"> <center>MENU</center> 1.Insert an element in queue<br> 2.Delete element from queue<br> 3.Display the contents of stack<br> Enter your choice : <input type="text" name="t1"><br> <input type="submit" value=ok>
foreach($a as $v) { echo"$v\t"; } array_unshift($a,'7'); echo"<br>After inserting an element queue is :"; foreach($a as $v) { echo"$v\t"; } break; case 2:echo"<br>ORIGINAL QUEUE IS :"; foreach($a as $v) { echo"$v\t"; } array_shift($a); echo"<br>Queue after deleting one element : "; foreach($a as $v) { echo"$v\t"; } break; case 3:echo"<br>ORIGINAL QUEUE IS :"; foreach($a as $v) { echo"$v\t"; } break; default :echo"Invalid choice"; }
?>
SLIP NO.24 Q1. <html> <body> <form action="file1.php" method="POST"> Enter 1st file name <input type="text" name=txt1><br> Enter 2nd file name <input type="text" name=txt2><br> Append <input type="radio" name="opt1" value="o"> <input type="submit" value="ok"> </form> </body> </html> <?php $f1=$_POST['txt1']; $f2=$_POST['txt2'];
$file1=fopen($f1,"r")or exit("cant open file");
echo "hello"; $file2=fopen($f2,"a+")or exit("cant open file");
$ename1=$_POST['txt1']; $s1="update event,committee,ec set status='working' where event.eno=ec.fk_eno and committee.cno=ec.fk_cno and etitle='$ename1'";
$result = pg_query($conn,$s1); if (!$result) { echo"ERROR.....";
} else { echo "record updated";
} ?>
SLIP NO.30 Q1. <html> <body> <form action="student.php" method=POST> Enter the name of competition<input type=text name="txt1"> <input type=submit value=ok> </form> </body> </html> <?php $conn=pg_connect("host=localhost port=5432 dbname=stud user=postgres password=123456"); if(!$conn) {
echo("An error.....in connection");
} else { echo("connection succesfull");
$cname1=$_POST['txt1']; $s1=pg_query("select stud1.sname from stud1,comp,sc where stud1.sno=sc.sno and comp.cno=sc.cno and comp.cname='$cname1' and sc.rank=1")or die(pg_error());