Jump to content

PHP Website not showing


Recommended Posts

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="SpryAssets/SpryValidationPassword.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationPassword.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
</head>
<?php 
phpinfo();
include('db.php');
include('functions.php');
if(isset($_POST['Submit'])){
$user = strval(trim(mysql_prep($_POST['user'])));
$search = mysql_query("SELECT user FROM hawaii_mls.users WHERE user = '{$user}'");


if(mysql_num_rows($search) == 1){
echo "User already registered";
?>
<body>
<form id="registration" name="registration" method="post" action=<?php echo $_SERVER['PHP_SELF']; ?>>
  
<table width="200" border="1">
  <tr>
    <td><label for="user">User: </label></td>
    <td><span id="sprytextfield1"><input type="text" name="user" id="user" /><span class="textfieldRequiredMsg">A value is required.</span></span></td>
  </tr>
  <tr>
    <td><label for="password">Password: </label></td>
    <td><span id="sprypassword1"><input type="password" name="password" id="password" />
    <span class="passwordRequiredMsg">A value is required.</span></span></td>
  </tr>
  <tr>
    <td><label for="email">Email: </label></td>
    <td><span id="sprytextfield2">
      <input type="text" name="email" id="email" />
      <span class="textfieldRequiredMsg">A value is required.</span></span></td>
  </tr>
  <tr>
  	  <td> </td>
      <td><input name="Submit" type="submit" value="Submit" /></td>
  </tr>
</table>
</form>
<script type="text/javascript">
var sprypassword1 = new Spry.Widget.ValidationPassword("sprypassword1");
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
</script>
</body>
<?php

} else {
mysql_query("INSERT INTO hawaii_mls.users (
user ,
password ,
email
)
VALUES (
'{$_POST['user']}', 
'{$_POST['password']}', 
'{$_POST['email']}'
);
") or die(mysql_error());

echo "User registration complete!";
}
}
?>

</html>

 

This is the code for the entire page. Please have a look.

 

Thank you.

 

Kind regards,

Jae

You have the majority of your html inside both the if( isset($_POST['Submit']) ) and if(mysql_num_rows($search) == 1) conditional statements. So by that logic, the form won't display unless it has been submitted . . .

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.