Hi,
Ive built an admin area for a site im working on. Ive set up a form where the customer services fill in the userid and email of a that user. My problem is that im trying to make the php script check that the userid and email configure against what is already stored in the database. I just dont know how to do it.
This is what i have so far
MY FORM
REGISTRATION.PHP
I want to then check that the inputed email address matches the email address that currently exists in the datbase for the given user id
If it does the script will carry on, if it doesn't ill echo something.
Thanks for any help
Ben
Ive built an admin area for a site im working on. Ive set up a form where the customer services fill in the userid and email of a that user. My problem is that im trying to make the php script check that the userid and email configure against what is already stored in the database. I just dont know how to do it.
This is what i have so far
MY FORM
Code:
<form action="register.php" method="post" onsubmit="return check(this)">
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td nowrap> <p class="formtext">First Name: <font color="#FF0000">*</font>
<br>
<input name="first_name" type="text" class="FormField" size=36>
</td>
<td valign="top"> <p class="formtext">Last Name: <font color="#FF0000">*</font>
<br>
<input name="last_name" type="text" class="FormField" size=36>
</td>
</tr>
<tr>
<td height="46">
<p class="formtext">Email:<font color="#FF0000">*</font>
<br>
<input name="email_address" type="text" class="FormField" size=36>
</td>
<td nowrap>
<p class="formtext">Unique User ID Number<font color="#FF0000">*</font> <br>
<input name="userid" type="text" class="FormField" size=6>
</td>
</tr>
<tr align="left">
<td colspan="2"> <input type="submit" name="add" value="Submit"></td>
</tr>
</table>
</form>
REGISTRATION.PHP
Code:
<?php
include '../db.php';
/* grabs the POST variables and puts them into variables that we can use */
$first_name= $_POST['first_name'];
$last_name= $_POST['last_name'];
$email_address= $_POST['email_address'];
$user_name= $_POST['email_address'];
$userid= $_POST['userid'];
/* Let's strip some slashes in case the user entered
any escaped characters. */
$first_name = stripslashes($first_name);
$last_name = stripslashes($last_name );
$email_address = stripslashes($email_address);
$user_name = stripslashes($user_name);
$userid = stripslashes($userid);
/* Do some error checking on the form posted fields */
if((!$first_name) || (!$last_name) || (!$email_address) || (!$userid)){
echo 'You did not submit the following required information! <br />';
if(!$first_name){
echo "First Name is a required field. Please enter it below.<br />";
}
if(!$last_name){
echo "Last Name is a required field. Please enter it below.<br />";
}
if(!$email_address){
echo "Email Address is a required field. Please enter it below.<br />";
}
if(!$userid){
echo "Email Address is a required field. Please enter it below.<br />";
}
include 'index.html'; // Show the form again!
/* End the error checking and if everything is ok, we'll move on to
creating the user account */
exit(); // if the error checking has failed, we'll exit the script!
}
I want to then check that the inputed email address matches the email address that currently exists in the datbase for the given user id
If it does the script will carry on, if it doesn't ill echo something.
Thanks for any help
Ben