Don't get variable to be passed to the page on submit
| From: | Davíð Örn Jóhannsson | Date: | Fri, 13 Dec 2002 16:03:19 +0000 |
| Subject: | Don't get variable to be passed to the page on submit | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-128169@lists.php.net to get a copy of this message | ||
I have this code whitch I have been staring at for hours and I just
cant figure out what is going on...
it is about as simple as it gets I just need to pass a variable from
this page to it self, and that would be tha variable $nafn
I have this included code included into another page that is why I use
the aAction and sAction variables in the from action
so the script knows where to go after submiting. I have done similar
things on this site Im working on an that works but this
i just cant get to work.
It is prob. just somthing silly and wery eazy but I could use some
assistance to finde out what.
Regards, David
<?php
if(!isset($submit)){
session_register("nafn");
?>
<form action="<?php echo
"$PHP_SELF?aAction=$aAction&sAction=$sAction&submit=1&test=test"; ?>"
method="post" enctype="text/plain" name="form">
<table width="450" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td>Nafn yfirflokks:</td>
<td><input type="text" name="nafn"
id="nafn"></td>
</tr>
</table>
<p>
<input type="submit" name="Submit" value="Vista flokk">
</p>
</form>
<?php
}
else{
print($test);
print($nafn);
$newQuery = "INSERT INTO $db_imgCat (catName, subCat) VALUES
('$nafn', 0)";
if(mysql_query($newQuery, $db) or die(mysql_error())){
print("Flokkur vistaður");
}
else{
print("fail");
}
}
?>