supermerc Posted February 17, 2008 Share Posted February 17, 2008 Hi, Im trying to make a registration script but im getting problems, Im not getting any errors but it doesnt work, like if i enter the information, even if its filled in it tells me i have to enter my first name you can try it here: http://r4ndom.com/yourplace/preg.php For some reason it gives me an error when I try posting my code so i put it on a paste site because it seems to be the only thing I can do so here it is: http://pastebin.com/m52d8f829 Thanks a lot in advance for helping me! Link to comment https://forums.phpfreaks.com/topic/91523-registration-script-problems/ Share on other sites More sharing options...
supermerc Posted February 17, 2008 Author Share Posted February 17, 2008 bump Link to comment https://forums.phpfreaks.com/topic/91523-registration-script-problems/#findComment-468854 Share on other sites More sharing options...
trq Posted February 17, 2008 Share Posted February 17, 2008 Your going to need to at least narrow your code down to the relevent parts and indent it so it is readable. Link to comment https://forums.phpfreaks.com/topic/91523-registration-script-problems/#findComment-468857 Share on other sites More sharing options...
supermerc Posted February 17, 2008 Author Share Posted February 17, 2008 what do you mean by indent? Link to comment https://forums.phpfreaks.com/topic/91523-registration-script-problems/#findComment-468861 Share on other sites More sharing options...
trq Posted February 17, 2008 Share Posted February 17, 2008 Most programmers follow consistent indentation to group parts of there code into blocks. eg; Parts within if{} statements are indented. eg; <?php if (expression) { echo "do something"; } else { echo "Do something else"; if (expression2) { echo "Do another thing"; } } ?> This makes code alot easier to read. It has pretty much been standard practice since procedural code was invented. Link to comment https://forums.phpfreaks.com/topic/91523-registration-script-problems/#findComment-468864 Share on other sites More sharing options...
supermerc Posted February 17, 2008 Author Share Posted February 17, 2008 is this better? http://pastebin.com/m56dde9e6 Link to comment https://forums.phpfreaks.com/topic/91523-registration-script-problems/#findComment-468870 Share on other sites More sharing options...
trq Posted February 17, 2008 Share Posted February 17, 2008 Yeah, a little. Your code really is quite the mess I'm sorry to say. Why do you have so many empty if statments? eg; if (expression) { // do nothing. } else { // here you do something. } These could just as easily be done using... if (!expression) { // do something. } As for your problem, you check if the variable $fname is empty on this line... if (empty($fname)) Yet I don't see $fname get defined anywhere in your code. Link to comment https://forums.phpfreaks.com/topic/91523-registration-script-problems/#findComment-468878 Share on other sites More sharing options...
supermerc Posted February 17, 2008 Author Share Posted February 17, 2008 thx, now its actually working, the only thing is now, I cant select between male and female, like if i select male, then it selects female. I cant select male at all. <td><label> <input type="radio" name="gender" value="female"> Female <input type="radio" name="gender" value="male"> Male</label></td> </tr> thats the code, I dont know whats wrong, but if i select male then it selects female and enters that in the database. Link to comment https://forums.phpfreaks.com/topic/91523-registration-script-problems/#findComment-468912 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.