Entry
Using "action=<? php echo $PHP_SELF ?>?form=yes method=post", but view source shows only this form.
Jan 26th, 2003 13:35
Peter Boyd,
Additional Information: the source code looks like:
<html>
<head>
<title>Sender</title>
</head>
<body>
<?php
if (@$form=="yes")
{
echo "<p>database was ".$database;
echo "<p> query was ".$query;
echo "<hr><br>
<form action=$PHP_SELF method=POST>
<input type=hidden name=query value=\"$query\">
<input type=hidden name=database value=$database>
<input type=submit name=\"queryButton\" value=\"New Query\">
<input type=submit name=\"queryButton\" value=\"Edit Query\">
</form>";
unset($form);
exit();
}
$query = stripSlashes($query);
if ($queryButton != "Edit Query")
{
echo $query;
$database = " ";
$query = " ";
}
?>
<form action="<?= $_SERVER ['PHP_SELF']; ?>?form='yes'" method="POST">
<table>
<tr>
<td align="right"><b>Type in database name</b></td>
<td>
<input type=text name="database" value=<?php echo $database ?> >
</td>
</tr>
<tr>
<td align="right" valign="top"><b>Type in SQL query</b></td>
<td><textarea name="query" cols="60" rows="10"><?php echo
$query ?></textarea>
</td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Submit
Query"></td>
</tr>
</table>
</form>
</body>
</html>
But the version (view source) in both cases looks like:
<html>
<head>
<title>Sender</title>
</head>
<body>
<form action="/test2.php?form='yes'" method="POST">
<p>first form</p>
<table>
<tr>
<td align="right"><b>Type in database name</b></td>
<td>
<input type=text name="database" value= >
</td>
</tr>
<tr>
<td align="right" valign="top"><b>Type in SQL query</b></td>
<td><textarea name="query" cols="60" rows="10"> </textarea>
</td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Submit
Query"></td>
</tr>
</table>
</form>
</body>
</html>
So, what am I doing wrong? or is there something I should have set
(Apache, PHP and MySql all seem to be working otherwise, and are all
essentially vanilla (except for the necessary Apache config changes))