you just give different names to your buttons like:
<input type="submit" name="b1">
<input type="submit" name="b2">
<input type="submit" name="b3">
then at the top of your page:
do like this:
<?
ob_start();
if($_POST['b1'])
{
header("location:one.php");
}
if($_POST['b2'])
{
header("location:two.php");
}
if($_POST['b3'])
{
header("location:three.php");
}
Shanti C
Posting Virtuoso
1,642 posts since Jul 2008
Reputation Points: 137
Solved Threads: 162
you just give different names to your buttons like:
<input type="submit" name="b1">
<input type="submit" name="b2">
<input type="submit" name="b3">
then at the top of your page:
do like this:
<?
ob_start();
if($_POST['b1'])
{
header("location:one.php");
}
if($_POST['b2'])
{
header("location:two.php");
}
if($_POST['b3'])
{
header("location:three.php");
}
That will just redirect the page once the button is clicked. To post the form data to different scripts depending upon the button clicked, you need to make use of javascript.
<html>
<head>
</head>
<body>
<form method="post" name="form">
<input type="text" name="name" />
<input type="submit" name="submit1" value="submit1" onclick="javascript: form.action='test1.php';" />
<input type="submit" name="submit2" value="submit2" onclick="javascript: form.action='test2.php';"/>
<input type="submit" name="submit3" value="submit3" onclick="javascript: form.action='test3.php';" />
</form>
</body>
</html>
nav33n
Purple hazed!
4,465 posts since Nov 2007
Reputation Points: 524
Solved Threads: 356
That will just redirect the page once the button is clicked. To post the form data to different scripts depending upon the button clicked, you need to make use of javascript.
ok naveen...
i have understand the thread in that way..
Shanti C
Posting Virtuoso
1,642 posts since Jul 2008
Reputation Points: 137
Solved Threads: 162
naveen, please tel me the difference between your post and my post....
Shanti C
Posting Virtuoso
1,642 posts since Jul 2008
Reputation Points: 137
Solved Threads: 162
In your post, it just redirects the user to respective page on button click. It doesn't post the form. In my post, I have specified the action for the form, so it posts the form data to respective script. That is, $_POST['name'] will be available in test1.php, test2.php and test3.php on respective button clicks.
nav33n
Purple hazed!
4,465 posts since Nov 2007
Reputation Points: 524
Solved Threads: 356
Shanti C
Posting Virtuoso
1,642 posts since Jul 2008
Reputation Points: 137
Solved Threads: 162