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

Link to comment
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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