Jump to content

registration script problems


supermerc

Recommended Posts

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

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.

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.