if( (!$firstname) or (!$lastname) or (!$username) or (!$password) )
{
$form ="Please enter all new user details...";
$form.="<form action=\"$self\"";
$form.=" method=\"post\">First Name: ";
$form.="<input type=\"text\" name=\"firstname\"";
$form.=" value=\"$firstname\"><br>Last Name: ";
$form.="<input type=\"text\" name=\"lastname\"";
$form.=" value=\"$lastname\"><br>User Name: ";
$form.="<input type=\"text\" name=\"username\"";
$form.=" value=\"$username\"><br>Password: ";
$form.="<input type=\"text\" name=\"password\"";
$form.=" value=\"$password\"><br>";
$form.="<input type=\"submit\" value=\"Submit\">";
$form.="</form>";
echo($form);
} else
{
$conn = @mysql_connect("localhost","root", "") or die("Could not connect to MySQL");
$db = @mysql_select_db("my_database",$conn) or die("Could not select database");
$sql = "insert into users (first_name,last_name,user_name,password)values (\"$firstname\",\"$lastname\",\"$username\",password(\"$password\") )";
$result = @mysql_query($sql,$conn)or die("Could not execute query"); if($result){
echo("New user $username added");
}
}
?>
</body></html>
By continuing to use this site, you agree to the use of cookies to personalize content and advertisements, to provide social media functionality, to analyze our traffic using Google services like Analytics and Adsense.
Google Adsense and its partners may use your data for advertising personalization and cookies may be used for personalized and non-personalized advertising. How does Google use my data? Please use the following button to see the list of Google partners as well as all the details regarding cookies.
In order to improve your experience, we use cookies to provide you with content, services and advertising tailored to your interests.Select your choice then click on 'OK' to validate your choices. modify them at any time from the Cookie Management page.
In order to improve your experience, we use cookies to provide you with content, services and advertising tailored to your interests.Select your choice then click on 'OK' to validate your choices. modify them at any time from the Cookie Management page. Cookies used: Google Adsense and its partners (partner details can be found on this page).
Allow statistics cookies to allow us to track the traffic to our sites and help us improve the quality of our services. Cookies used: Google Analytics
These cookies are necessary for the functioning of the website and can not be disabled in our systems and are usually defined only in response to actions on your part that constitute a request for services, such as the definition of your privacy preferences, logging in or filling forms.