You're right. I just tried it out. We don't want action, we want onsubmit:
Code:
<form method="post" onsubmit="ajaxpage('submit.php?var=foo&FORM1=' + this.elements.FORM1.value + '&FORM2=' + this.elements.FORM2.value, 'bar'); return false;">
Otherwise everything else is the same. With this one change, it's working here.
One proviso though. You have as your submit.php file:
Code:
$var= $_GET["var"];
$FORM1 = $_GET["FORM1"];
$FORM2 = $_GET["FORM2"];
$out = $var . ' ' . $FORM1. ' ' . $FORM2;
echo $out;
It should (and may well, you may have just left out the obvious) be:
Code:
<?php
$var= $_GET["var"];
$FORM1 = $_GET["FORM1"];
$FORM2 = $_GET["FORM2"];
$out = $var . ' ' . $FORM1. ' ' . $FORM2;
echo $out;
?>
Or, to be on the safe side:
PHP Code:
<?php
$var= isset($_GET["var"])? $_GET["var"] : '';
$FORM1 = isset($_GET["FORM1"])? $_GET["FORM1"] : '';
$FORM2 = isset($_GET["FORM2"])? $_GET["FORM2"] : '';
$out = $var . ' ' . $FORM1. ' ' . $FORM2;
echo $out;
?>
You may substitute/insert default values for/into the empty single quotes in these lines:
Code:
$var= isset($_GET["var"])? $_GET["var"] : '';
$FORM1 = isset($_GET["FORM1"])? $_GET["FORM1"] : '';
$FORM2 = isset($_GET["FORM2"])? $_GET["FORM2"] : '';
Bookmarks