|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: |
### ------HTML FORM--------- ###
<form action="adduser.php" method="post">
First name:<br>
<input type="text" name="fname"><br>
Last name:<br>
<input type="text" name="lname"><br>
Email:<br>
<input type="text" name="email"><br>
Password:<br>
<input type="password" name="password"><br>
School/University:<br>
<input type="text" name="school_name"><br>
City:<br>
<input type="text" name="city"><br>
State:<br>
<input type="text" name="state">
<INPUT type="submit" value="send"><INPUT type="reset">
###----- PHP-----###
<?php
include 'config.php';
include 'opendb.php';
/* Check all form inputs using check_input function */
$fname = check_input($_POST['fname'], "Enter your first name.");
$lname = check_input($_POST['lname'], "Enter your last name.");
$password = check_input($_POST['password'], "Enter your pass.");
$email = check_input($_POST['email'], "Enter your Email.");
$school_name = check_input($_POST['school_name'], "Enter your School Name.");
$city = check_input($_POST['city'], "Enter your City.");
$state = check_input($_POST['state'], "Enter your State.");
/* If e-mail is not valid show error message */
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email))
{
show_error("E-mail address not valid");
}
else{
$data = "INSERT INTO users VALUES ('NULL', '$fname', '$lname', '$password', '$email', '$school_name', '$city', '$state')";
$query = mysql_query($data);
if(!$query)
{
die(mysql_error());
}
else
{
/* Redirect page */
/*header('Location: thanks.html');*/
}
echo "<TD valign='top'><br /><center><b>You successed!";
echo "<br>";
}
/* Functions I used to check */
function check_input($data, $problem='')
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
if ($problem && strlen($data) == 0)
{
show_error($problem);
}
return $data;
}
function show_error($myError)
{
?>
<html>
<body>
<b>Please correct the following error:</b><br />
<?php echo $myError; ?>
</body>
</html>
<?php
exit();
}
?>
|
Advertisement
| Hall of Fame |