<!--6]Write a PHP script for the following: Design a form to accept
two strings. Compare the two strings using both methods (= = operator
&strcmp function). Append second string to the first string. Accept the
position from the user; from where the characters from the first string are
reversed. (Use radio buttons)-->
<html>
<body>
<form action="slip6.php" method="post">
<table border="1">
<tr><td>Enter First String : </td><td><input
type="text" name="str1"></td><tr>
<tr><td>Enter second string : </td><td><input
type="text" name="str2"></td><tr>
<tr><td>Enter position : </td><td><input
type="text" name="str23"></td><tr>
<tr><td><input type="radio" name="ch"
value=1>compare</td>
<td><input type="radio" name="ch" value=2>with
datatype</td>
<td><input type="radio" name="ch"
value=3>append</td>
<td><input type="radio" name="ch"
value=4>possition for reverse.</td></tr>
<tr><td><input type="submit"
value="check"><input type="reset"
value="cancel"></td></tr>
</table>
</form>
</body>
</html>
<?php
$str1=$_POST['str1'];
$str2=$_POST['str2'];
$pos=$_POST['pos'];
$ch=$_POST['ch'];
echo
"Second string::$str2.<br><br>";
echo"position
for reverse::$pos.<br><br>";
echo"choice
is::$ch.<br><br>";
switch($ch)
{
case
1:
if($str1==$str2)
echo"Both
string are equal.<br>";
else
echo"Both
string are not equal.<br>";
break;
case
2:
if($str1===$str2)
echo"Both
are exat equal.<BR>";
else
echo"Both
are not equal.<BR>";
break;
case
3:
echo"After
appending::";
echo
"$str1"."$str2";
echo"<br>";
break;
case
4: $len=strlen($str1)-$pos;
$s=substr($str1,$pos,$len);
$str4=strrev($s);
echo
"After reverse::$str4.<br>";
break;
}
?>