Write a PHP program to accept two strings from user and check whether entered strings are matching or not ?(Use sticky form concept).
Answers
Answered by
1
<html>
<body>
<form method=post action="Sticky.php">
<fieldset>
<legend>Enter Strings in the text Boxes !</legend>
<p><b>String1 :</b><input type=text name=s1 value="<?php if(isset($_POST['s1'])) echo $_POST['s1'];?>"></p>
<p><b>String2 :</b><input type=text name=s2 value="<?php if(isset($_POST['s2'])) echo $_POST['s2'];?>"></p>
</fieldset>
<div align=center>
<input type=submit name=submit value="submit string">
</div>
<input type="hidden" name="submit" value=true>
</form>
<?php
if(isset($_POST['submit']))
{
$s1=$_POST['s1'];
$s2=$_POST['s2'];
if(strcmp($s1,$s2)==0)
echo"<br><b>Matching</b>";
else
echo"<br><b>Not Matching</b>";
}
?>
</body>
</html>
Similar questions
Hindi,
7 months ago
Chemistry,
7 months ago
Science,
7 months ago
Social Sciences,
1 year ago
Business Studies,
1 year ago
Computer Science,
1 year ago