PDA

View Full Version : PHP button problem



reza01
06-30-2009, 04:30 AM
hi......
I have 2 button.
I want each of them submit form and when open a.php give $id to that page.
for example.
if $id =20: (../a.php?20 ).

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>Untitled 1</title>
</head>

<body>

<form method="post" action="a.php">
<input name="Button1" type="button" value="button1" /><input name="Text1" type="text"></form>
<p><input name="Button2" type="button" value="button2" /><input name="Text2" type="text"></p>

</body>

</html>
<?php
$id=20;
?>
//../a.php?id=20

Eriksrocks
06-30-2009, 03:28 PM
I can barely understand what you're asking, but I'll give it a shot...


<?php
$id=20;
?>
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>Untitled 1</title>
</head>

<body>

<form method="post" action="a.php?id=<?php echo $id; ?>">
<input name="Button1" type="submit" value="button1" /><input name="Text1" type="text"></form>
<p><input name="Button2" type="submit" value="button2" /><input name="Text2" type="text"></p>

</body>

</html>

When either button is clicked, it will submit the form and take the user to a.php?id=20. :)