Jump to content

My PHP script isn't working :(


xQuasar

Recommended Posts

<html>
<head>
<title>Kings Of Ruse :: Registration</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="black">
<?php
if(isset($_POST['add']))
{
include 'mysql/login.php';
include 'mysql/open.php';

$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];
$race = $_POST['race'];

$query = "INSERT INTO accounts (username, password, email, race) VALUES ('$username', '$password', '$email', '$race')";
mysql_query($query) or die('Error, insert query failed');

include 'mysql/close.php';
echo "Registered!";
}
else
{
?>
<form method="post">
<table width="400" border="0" cellspacing="12" cellpadding="2">
<tr>
<td width="100"><font face="Verdana" color="white" size="2">Username</font></td>
<td><input type='text' name='username' id='username' size='30' maxlength='12'  value=''></td>
</tr>
<td width="100"><font face="Verdana" color="white" size="2">Password</font></td>
<td><input type='password' name='password' id='password' size='30' maxlength='12'  value=''></td>
</tr>
<td width="100"><font face="Verdana" color="white" size="2">Confirm Pass</font></td>
<td><input type='password' name='confirmp' id='confirmp' size='30' maxlength='12'  value=''></td>
</tr>
<tr>
<td width="100"><font face="Verdana" color="white" size="2">Email Address</font></td>
<td><input type='text' name='email' id='email' size='30' maxlength='30'  value=''></td>
</tr>
<tr>
<td width="100"><font face="Verdana" color="white" size="2">Confirm Email</font></td>
<td><input type='text' name='confirme' id='confirme' size='30' maxlength='30'  value=''></td>
</tr>
<td width="100"><font face="Verdana" color="white" size="2">Race</font></td>
<td>
<select name="race" id="race">
<option selected value="0">Choose race            
                  
  </option>
<option value="1">Victors</option>
<option value="2">Brians</option>
<option value="3">SunWoos</option>
<option value="4">Austins</option>
<option value="5">D***ds</option>
</select>
</td>
</tr>
<tr>
<td width="100"> </td>
<td> </td>
</tr>
<tr>
<td width="100"> </td>
<td>
<input type='submit' name='submit' value='Submit'> <input type='reset' name='reset' value='Reset'><br />
</td>
</tr>
</table>
</form>
<?php
}
?>
</body>
</html>

 

All it does when I click 'Register' is refresh the page. The data doesn't get sent to mySQL, but nor are there any errors. Help please? What's wrong with it T_T

Link to comment
https://forums.phpfreaks.com/topic/134830-my-php-script-isnt-working/
Share on other sites

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.