Read this: http://www.php.net/variables.external
Pay special attention to the parts about the PHP directive register_globals. If on, both $_GET['nafn'] and $nafn will exist. If off, $nafn will not exist. As of PHP 4.2.0, the default for this in php.ini went from on to off. This applies to all variables, even web server variables such as PHP_SELF so you'd use: $_SERVER['PHP_SELF'], etc. Regards, Philip Olson P.s. So you want your query to look more like this: $sql = INSERT INTO $db_imgCat (catName, subCat) VALUES ('{$_GET['nafn']}', 0)"; P.s.s. Consider validating nafn first, users are evil. P.s.s.s. Use $_SESSION instead of session_register On Fri, 13 Dec 2002, [iso-8859-1] Davíð Örn Jóhannsson wrote: > I have this code whitch I have been staring at for hours and I just > can’t 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 I’m working on an that works but this > i just can’t 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"); > } > > } > ?> > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php