954,576 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

2 forms on 1 page

I have a form which the user enter info. I have 2 buttons - 1 takes data to next page to save data. The other button recalculates and re displays the same page. The problem is I cant read the data in the second form. It is blank. How can I use input data in the 2 forms

Kfd
Newbie Poster
2 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 
<html>
<head>
<title></title>
</head>
<body>
<?php
// Here you do the calculations, for example + 2
if ($_POST['calculatebutton']) {
$displaydata = $_POST['number'];
$displaydate = $displaydate + 2;
} else {
$displaydata = 0;
}
// The form
echo "
<form>
Number: <input type=\"text\" size=\"1\" name=\"number\" value=\"".$displaydata."\" />
<input type=\"submit\" name=\"sendbutton\" value=\"Send Form\" />
<input type=\"submit\" name=\"calculatebutton\" value=\"Calculate my number into a new one!\" />
</form>
";
?>
</body>
Graphix
Posting Pro in Training
432 posts since Aug 2009
Reputation Points: 82
Solved Threads: 74
 

many thanks

Kfd
Newbie Poster
2 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You