Molarmite Posted May 2, 2007 Share Posted May 2, 2007 My code for my register page breaks right here and I can't figure out why. <? if (action == 'signup'){?><? if ($psword == $ConfirmPassword){$passdun = yes; }else{ echo"Passwords do not match<br>"; $passdun = no;} Link to comment https://forums.phpfreaks.com/topic/49590-whats-wrong-with-this-code/ Share on other sites More sharing options...
clown[NOR] Posted May 2, 2007 Share Posted May 2, 2007 try using <?php instead of <? Link to comment https://forums.phpfreaks.com/topic/49590-whats-wrong-with-this-code/#findComment-243135 Share on other sites More sharing options...
Molarmite Posted May 2, 2007 Author Share Posted May 2, 2007 Nope, that didn't do anything. Do you need more of the code? Link to comment https://forums.phpfreaks.com/topic/49590-whats-wrong-with-this-code/#findComment-243138 Share on other sites More sharing options...
trq Posted May 2, 2007 Share Posted May 2, 2007 There are no such constants as yes and no. Should be... <?php if (action == 'signup') { if ($psword == $ConfirmPassword) { $passdun = "yes"; } else { echo "Passwords do not match"; $passdun = "no"; } } ?> Or better still, use booleans. <?php if (action == 'signup') { if ($psword == $ConfirmPassword) { $passdun = true; } else { echo "Passwords do not match"; $passdun = false; } } ?> Link to comment https://forums.phpfreaks.com/topic/49590-whats-wrong-with-this-code/#findComment-243141 Share on other sites More sharing options...
Molarmite Posted May 2, 2007 Author Share Posted May 2, 2007 There's something wrong and I have a feeling it's bigger than what you suggested. Here's more of the code. <input type="submit" value="Register"> </form> <php? if (action == 'signup'){?><? if ($psword == $ConfirmPassword){$passdun = true; }else{ echo"Passwords do not match<br>"; $passdun = false;} if ($Email == $conEmail){ $emaildun = yes;}else{ echo"Email Address's dont match<br>"; $emaildun = no;} if (($passdun == 'yes') && ($emaildun == 'yes')){$insert_user = mysql_query("INSERT INTO `World Of Darkness` ( `ID` , `Password` , `Email` , `HP` , `Mana` , `Gold` ) When upload it to my site and view it, the top of half of the code (which isnt posted here) works just fine, but after my register button, it says this part of the code "; $passdun = false;} if ($Email == $conEmail){ $emaildun = yes;}else{ echo"Email Address's dont match "; $emaildun = no;} if (($passdun == 'yes') && ($emaildun == 'yes')){$insert_user = mysql_query("INSERT INTO `World Of Darkness` ( `ID` , `Password` , `Email` , `HP` , `Mana` , `Gold` ) VALUES ( '', '$password', '$Email', '', '0, '' ) "); echo"thank you";}else{ echo"im sorry but there were some problems";}}?> Link to comment https://forums.phpfreaks.com/topic/49590-whats-wrong-with-this-code/#findComment-243150 Share on other sites More sharing options...
trq Posted May 2, 2007 Share Posted May 2, 2007 Look at the opening <?php tag. You have <php? PS; You really should get into the habit of formatting your code cleaner. Your code is VERY difficult to read, even just those few lines. Link to comment https://forums.phpfreaks.com/topic/49590-whats-wrong-with-this-code/#findComment-243160 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.