Note: this project is being restarted after one year of in-action, using the most relevant files I am able to locate. All final code will be adapted to MySQLi.
Versions of this code functioned properly to the best of my knowlege; now, with a new host I am having issues saving data to the db after a connection is made.
I have been researching the potential issue online but would like some advice regarding possible problems/errors regarding this issue before I proceed with editing the files.
Thank you in advance,
Matty
snippet of index.html
`
<?php
function NewUser()
{
$userName = $_POST['user'];
$email = $_POST['email'];
$password = $_POST['pass'];
$countries = $_POST['countries'];
$state = $_POST ['state'];
$city = $_POST['city'];
$company = $_POST ['company'];
$manager1 = $_POST['manager1'];
$manager2 = $_POST['manager2'];
$query = "INSERT INTO X1 Table 1 (userName,email,password,countries,state,city,company,manager1,manager2) VALUES ('$userName','$email','$password','$countries','$state','$city','$company','$manager1','$manager2')";
$data = mysql_query ($query)or die(mysql_error());
if($data)
{
echo $state
//echo "YOUR REGISTRATION IS COMPLETED...";
}
}
function SignUp()
{
if(!empty($_POST['userName'])) //checking the 'user' name which is from Sign-Up.html, is it empty or have some text
{
if ($_POST['equals_val'] != ($_POST['first_val'] + $_POST['second_val'])) {
echo "CAPTCHA IS NOT CORRECT";
} else {
$query = mysql_query("SELECT * FROM X1 WHERE userName = '$_POST[userName]' AND pass = '$_POST[password]'") or die(mysql_error());
if(!$row = mysql_fetch_array($query) or die(mysql_error()))
{
NewUser();
}
else
{
echo "SORRY...YOU ARE ALREADY REGISTERED USER...";
}
}
}
}
if(isset($_POST['submit']))
{
SignUp();
}
if (isset($_POST['type'])) {
if ($_POST['type'] == "login")
}
?>
Inline Code Example Here
`
connect.php
`
<?php
$serverName = "localhost";
$userName = "*****";
$password = "**********";
$dbName = "******";
// Create connection
$conn = new mysqli($serverName, $userName, $password, $dbName);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Prepare and bind
$userName = $_POST['user'];
$email = $_POST['email'];
$password = $_POST['pass'];
$countries = $_POST ['countries'];
$state = $_POST ['state'];
$city = $_POST['city'];
$company = $_POST ['company'];
$manager1 = $_POST ['manager1'];
$manager2 = $_POST ['manager2'];
echo "Thank you for registering - New records created successfully!";
?>
`