Jump to content

Newbie Question


Qbart

Recommended Posts

Hello,

I'm very new to php and mysql.  I've just created a domain and a linux host account at goddady.com.  I have created a simple database with a table that has valid email addresses that I have confirmed that are from people that will be allowed to register.  What I would like to do is be able to have a form on my homepage that will give the user two choices, one login or two register.  Before they register though they have to enter their email address, if the email address matches one in the table they will be allowed to register.  If not then they will have to email me to validate their email address and I'll manually enter it into the table, then they can register.

How would I do this?  I'm pretty sure I can handle the basic registration script its the one that checks the table for a valid email address first that I'm having a problem with.

Any and all help will be greatly appreciated.

Thanks in advance.

Q

Link to comment
https://forums.phpfreaks.com/topic/35060-newbie-question/
Share on other sites

First you would search for the email they submitted in the database then check if it is there.

[code]
<?php

$email = $_POST['email'];

$email_search = mysql_query("SELECT email FROM table WHERE email='$email'");
$num = mysql_num_rows($email_search);

if ($num >= 1){
  echo "This email is in the database! Feel free to register";

} else {
  echo "This email is not in the database. You are not allowed to register";
exit;
}

?>

[/code]

Is this what you wanted?
Link to comment
https://forums.phpfreaks.com/topic/35060-newbie-question/#findComment-165461
Share on other sites

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.