It didn't work. Several things:
1 - I had the target for Aform be _self and for Bform be _blank since it is
in A form with the _self that the list exists.
1 - The action path is "", even though you said you put one in. I left it
that way.
2 - I assume you meant document.Bform.submit(); and not
document.Aform.submit();
3 - If I made the change to Bform (above), then it opened a new window
(according to Bform), but it didn't pass the value of theList, even though I
have the B button in A form, and the page that is brought up in that new
window is the current page, not the redirected one. Aform works fine.
4 - If I left it at Aform, it doesn't work either.
Here is the code:
junk.php
======
<?php
if (isset($_POST['A'])) {
$val = $_POST['theList'];
echo "A0=" . $val . "<br>";
} else if (isset($_POST['B'])) {
$val = $_POST['theList'];
header("Location: junk2.php?val=" . $val);
exit();
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Untitled Document</title></head>
<form action="" method="post" target="_self" name="Aform">
<select name="theList">
<option value="First">First</option>
<option value="Second">Second</option>
</select>
<input type="submit" name="A" value="submit A">
<input type="button" name="B" value="submit B"
onClick="document.Bform.submit()">
</form>
<form action="" method="post" target="_blank" name="Bform">
</form>
<body></body></html>
junk2.php
=======
<?php
$val = $_GET['val'];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
The value of val is <?php echo $val . "<br>"; ?>
</body></html>
"NurAzije" <nurazije@gmail.comwrote in message
news:1161067525.892546.259600@b28g2000cwb.googlegr oups.com...
Quote:
For AJAX it is so easy, you have a 5 minutes tutorial on this link :
http://www.nurazije.co.nr/2006/10/5-...-tutorial.html
>
You can put the second bottun in the first form, like this:
<form action="" method="POST" name="Aform" target="_blank">
<select name="theList">
<option value="First'">First </option>
<option value="Second'">Second </option>
</select>
....other stuff...
<input type="submit" value="Form A button" name="A">
<input type="button" value="Form B button" name="B"
onclick="document.Aform.submit();">
</form>
You will see I have added onclick="document.Aform.submit();", and the
type is button, put an action path for the form, and change the form
name as I did, every element must have a unique name.
The php code must look like this:
<?php
if (isset($_POST['A'])) {
$list = $_POST['theList'];
header('Location: A_target.php?list=' . $list);
exit();
}elseif(isset($_POST['B'])) {
$list = $_POST['theList'];
header('Location: B_target.php?list=' . $list);
exit();
}
?>
Thats it, hope you got the idea...
>