I am just stucked. Would be great if someone can help me.
I have created form. Has also created a session in php to view the data and reuse it for editting any data. While trying to edit all the default values which are inputed in the form are coming in all fields except the value for radio button(no value is checked)
I am giving a short coding for all 3 pages:
Page 1: (HTML- FORM)
Code: Select all
<html>
<body>
<form action="page2.php" method="post">
Name : <input type="text" name="name"/>
Discount: <input type="radio" name="discount" value="2"> TWO </br>
<input type="radio" name="discount" value="4"> THREE
<input type="submit" value="Submit"/>
</form>
</body>
</html>
Code: Select all
<html>
<?php session_start();?>
<body>
<form action="page3.php" method="post">
Name :<?php
$name=$_POST['name'];
$_SESSION['name']=$name;
echo $_SESSION['name']; ?>
Discount:<?php
$discount=$_POST['discount'];
$_SESSION['discount']=$discount;
echo $_SESSION['discount']; ?>
<input type="Submit" value="Edit">
</form>
</body>
</html>Code: Select all
<html>
<?php session_start();?>
<head>
<?php
$name=$_SESSION['name'];
$discount=$_SESSION['discount'];
echo
"<form action=\"page4.php\" method=\"POST\">
Name :<input type=\"text\" name=\"name\" value=\"$name\"/> </br>
<input type=\"radio\" name=\"discount\" value=\"2\"<?php if($discount=='2') echo 'checked=\"checked\"'; ?> TWO
<br/>
<input type=\"radio\" name=\"discount\" value=\"4\" <?php if($discount=='4') echo 'checked=\"checked\"'; ?> FOUR
<br/>
<input type=\"submit\" value=\"Confirmed\"/>";
?>
</body>
</html>Also, it will be a great help if someone can tell me how to validate the fields on page3 before processing to page4.
THank you ver very much.......