Jump to content

raversnet

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

raversnet's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ok after i turned off the Register_Globals it quit working.  Shoulda did that in the first place.  After updating the line: [code]$ret=add_to_database($_POST['domain'], $_POST['sex'], $_POST['mail'], $dberror);[/code] It worked just fine with Globals off.  Thanks again, R.
  2. Ok i removed the Post Vars loop and replaced the ISSET line with: [code]if (isset ($_POST['domain']) && isset($_POST['sex']) && isset ($_POST['mail'])){[/code] It works now which is fantastic.  Thing is i never had to replace all other references to $domain, etc.  They just work.  Why would ISSET be the only function affected.  If that makes any sense. Thanks for the help btw. R.
  3. Greetings all.  Im currently trying to learn PHP and have stumbled across this problem on numerous occasions already.  I understand that when i submit a form in example1.php and with the ACTION arguement call another file such as example2.php.  That i cannot pass the values without [color=red]register_globals[/color] being set to ON in the php.ini file.  Unless i use the built in $HTTP_POST_VARS array. But if im not calling another file and simply wish to submit a form back to its own document using global $PHP_SELF(or just be default it should do this anyways).  Having [color=red]register_globals[/color] set to OFF shouldnt matter. The script im trying to get working is this: [code]<html> <head> </head> <body> <?php $PARAMS=$HTTP_POST_VARS;    ///  I ADDED THIS JUST TO SEE IF THE VARIABLES DID IN FACT EXIST foreach ($PARAMS as $key=>$value){   print "$key=$value <br>"; } if (isset ($domain) && isset($sex) && isset ($mail)){   // check user input here!   $dberror="";   $ret=add_to_database($domain, $sex, $mail, $dberror);   if (!$ret)   print "Error: $dberror<BR>"; else print "Thank you very much"; } else {   write_form(); } function add_to_database($domain, $sex, $mail, &$dberror){   $user = "raversnet";   $pass = "5434697";   $db = "test";   $link=mysql_pconnect("myth3",$user, $pass);   if (!$link){     $dberror="Couldnt connect to MySQL server"; return false; } if (!mysql_select_db($db, $link)){   $dberror=mysql_error();   return false; } $query="INSERT INTO domains (domain, sex, mail) values ('$domain','$sex','$mail')"; if (!mysql_query($query, $link)){   $dberror=mysql_error();   return false; } return true; } function write_form(){   global $PHP_SELF;   print "<form method=\"POST\">";   print "<input type=\"text\" name=\"domain\">";   print "The domain you would like<p>";   print "<input type=\"text\" name=\"mail\">";   print "Your mail address<p>";   print "<select name=\"sex\">";   print "\t<option value=\"M\"> Male";   print "\t<option value=\"F\"> Female";   print "</select>";   print "<input type=\"submit\" value=\"submit!\"></form>"; } ?> </body> </html>[/code]   The script displays the variables whether the [color=red]register_globals[/color] are on or off.  Doesnt matter.  However the script Function ISSET doesnt work unless its set to ON.  I can get the script working with [color=red]register_globals[/color] OFF if i cycle through the array but really as far as i know....i shouldnt have to. Any help is appreciated, Thanks, Rob
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.