Note that there are some explanatory texts on larger screens.

plurals
  1. POregistration php file.
    primarykey
    data
    text
    <p>I have been trying to get this sign up php to work. I'm close, I guess. But there's a problem. The result is always a button that redirects to the homepage(You'll know what I'm talkin about when you read the code.) If you could find the problem please tell me.</p> <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" id="jmtoday" class=" no_js"&gt; &lt;head&gt; &lt;link href='icon.jpg' rel='icon' type='image/jpg'/&gt; &lt;meta http-equiv="Content-type" content="text/html; charset=utf-8" /&gt; &lt;meta http-equiv="Content-language" content="en" /&gt; &lt;LINK REL=StyleSheet HREF="Mainstyles.css" TYPE="text/css"&gt;&lt;/link&gt; &lt;Title&gt;Sign up to JM Today&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;?php $dbservertype='mysql'; $servername='localhost'; $dbusername='***'; $dbpassword='***'; $dbname='jmtdy'; function connecttodb($servername,$dbname,$dbuser,$dbpassword) { global $link; $link=mysql_connect("$servername","$dbuser","$dbpassword"); if(!$link){ die("Could not connect to MySQL"); } mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error()); } connecttodb($servername,$dbname,$dbusername,$dbpassword); ?&gt; &lt;?php $username=mysql_real_escape_string($_POST['username']); $password=mysql_real_escape_string($_POST['password']); $password2=mysql_real_escape_string($_POST['password_confirmation']); $todo=mysql_real_escape_string($_POST['todo']); $email=mysql_real_escape_string($_POST['email']); $fname=mysql_real_escape_string($_POST['fname']); $lname=mysql_real_escape_string($_POST['lname']); if(isset($todo) and $todo=="post"){ $status = "OK"; $msg=""; } if(!isset($username) OR strlen($username) &lt;3){ $msg=$msg."Username should be equal to or more than 3 characters long&lt;BR/&gt;"; $status= "NOTOK"; } if(mysql_num_rows(mysql_query("SELECT username FROM users WHERE username = '$username'")or die (mysql_error ()))){ $msg=$msg."Username already exists. Please try another one&lt;BR/&gt;"; $status= "NOTOK";} if ( strlen($password) &lt; 3 ){ $msg=$msg."Password must be more than 3 charactors long&lt;BR/&gt;"; $status= "NOTOK"; } if ( $password &lt;&gt; $password2 ){ $msg=$msg."Passwords are not identical.&lt;BR/&gt;"; $status= "NOTOK"; } if($status="NOTOK"){ echo "$msg&lt;br/&gt;&lt;input type='button' value='Retry' onClick='history.go(-1)'&gt;"; } else { if(mysql_query("insert into users(username,password,email,fname,lname) values('$username','$password','$email','$fname','$lname')")or die (mysql_error ())){ echo "Welcome, You have successfully signed up"; } else { echo "Database Problem, please contact Site admin"; } } ?&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload