Page 1 of 1

Probs with code when switching from php3 to php4

Posted: Thu Jun 27, 2002 2:48 pm
by jayymz
Hi,

this piece of code worked perfectly before switch to the latest php version, I've looked for tutorials and other things to help me around this - but no luck....

The error I get is that the variable submit is undefined

Code: Select all

<?php

if ($submit) &#123;    // <----- the error is here?

$db = mysql_connect("host", "user", "pw");

mysql_select_db("db1",$db);

$sql = "INSERT INTO sel_utb (user,educ,dist,focus) VALUES ('$user','$educ','$dist','$focus')";

  $result = mysql_query($sql);

?>
  <blockquote>
  <p><font size="-2" face="Verdana, Arial, Helvetica, sans-serif"> Submit recieved!</font></p>
</blockquote>

<?php

&#125; else &#123;

  // display form

?>
<form method="post" action="<?php echo $PHP_SELF?>">
  <blockquote> 
    <p><font size="-2" face="Verdana, Arial, Helvetica, sans-serif">Namn:</font><br>....

  lots of html.....
 
      <input type="Submit" name="submit" value="Send">
    </p>
  </blockquote>
</form>
 
<?php

&#125;

?>

Any help would be appreciated

/james

Posted: Thu Jun 27, 2002 3:20 pm
by RandomEngy
Have you read this?

Posted: Thu Jun 27, 2002 4:10 pm
by jayymz
omg.....

i suck at searching the internet :) :)