I am trying to get this information into the database but it won’t show up at all. It is supposed to say “You have entered 1 new lead” or something like that, but it doesn’t. Also, there is an error message that says "[FONT=Arial]cannot instantiate non-existent class: mysqli in /homepages/18/d166983733/htdocs/admin/insert_client.php on line 167"[/FONT]
Here is the line 167:
$db = new mysqli('localhost', 'db456', '123456', 'clienttable');
<?php
if (!$salesperson || !$client || !$address || !$contactname1 || !$contactphone1 || !$contactemail1 || !$contactname2 || !$contactphone2 || !$contactemail2 )
{
echo '<font color="red">You have not entered all the required details.<br />'
.'Please go back and try again.</font>';
}
if (!get_magic_quotes_gpc())
{
$salesperson= addslashes($salesperson);
$client = addslashes($client);
$address = addslashes($address);
$contactname1= addslashes($contactname1);
$contactphone1 = addslashes($contactphone1);
$contactemail1 = addslashes($contactemail1);
$contactname2= addslashes($contactname2);
$contactphone2 = addslashes($contactphone2);
$contactemail2 = addslashes($contactemail2);
}
if ( $salesperson )
{
echo '<p><b>Thank You </b>';
echo $salesperson.'</b><b><p><h3><font face="Arial" color="#0066CC">Here is the information entered on this new lead:</h3></font></b></p>';
}
else
{
echo '<p><b>Who Are You?: </b>';
echo '<font color="red">You did not enter <b>Your Name</b>.</font><br />';
}
if ( $client )
{
echo '<p><b>Lead Name: </b>';
echo $client.'<br />';
}
else
{
echo '<p><b>Lead Name: </b>';
echo '<font color="red">You did not enter a <b>Client Name</b>.</font><br />';
}
if($projecttype == 'a')
echo '<p><b>Lead Type: </b>Live Sound Reinforcement.</p>';
elseif($projecttype== 'b')
echo '<p><b>Lead Type: </b>Sound Design & Integration.</p>';
if ( $address )
{
echo '<p><b>Address: </b>';
echo $address.'<br />';
}
else
{
echo '<p><b>Address: </b>';
echo '<font color="red">You did not enter an <b>Address</b>.</font>';
}
if ( $contactname1 )
{
echo '<p><b>Contact 1: </b>';
echo $contactname1.'<br />';
}
else
{
echo '<p><b>Contact 1: </b>';
echo '<font color="red">You did not enter a <b>Contact 1 Name</b>.</font>';
}
if ( $contactphone1 )
{
echo '<b><br> Phone: </b>';
echo $contactphone1.'<br />';
}
else
{
echo '<b><br> Phone: </b>';
echo '<font color="red">You did not enter a <b>Contact 1 Phone</b>.</font>';
}
if ( $contactemail1 )
{
echo '<b><br> Email: </b>';
echo $contactemail1.'<br />';
}
else
{
echo '<b><br> Email: </b>';
echo '<font color="red">You did not enter a <b>Contact 1 Email</b>. (Put "N/A" if none)</font>';
}
if ( $contactname2 )
{
echo '<p><b>Contact 1: </b>';
echo $contactname2.'<br />';
}
else
{
echo '<p><b>Contact 1: </b>';
echo '<font color="red">You did not enter a <b>Contact 1 Name</b>.</font>';
}
if ( $contactphone2 )
{
echo '<b><br> Phone: </b>';
echo $contactphone2.'<br />';
}
else
{
echo '<b><br> Phone: </b>';
echo '<font color="red">You did not enter a <b>Contact 1 Phone</b>.</font>';
}
if ( $contactemail2 )
{
echo '<b><br> Email: </b>';
echo $contactemail2.'<br />';
}
else
{
echo '<b><br> Email: </b>';
echo '<font color="red">You did not enter a <b>Contact 1 Email</b>. (Put "N/A" if none)</font>';
}
// create short variable names
$salesperson=$_POST['salesperson'];
$client=$_POST['client'];
$address=$_POST['address'];
$contactname1=$_POST['contactname1'];
$contactphone1=$_POST['contactphone1'];
$contactemail1=$_POST['contactemail1'];
$contactname2=$_POST['contactname2'];
$contactphone2=$_POST['contactphone2'];
$contactemail2=$_POST['contactemail2'];
$db = new mysqli('localhost', 'db456', '123456, 'clienttable');
if (mysqli_connect_errno())
{
echo 'Error: Could not connect to database. Please try again later.';
exit;
}
$query = "insert into clienttable values
('".$salesperson."', '".$client."', '".$address."', '".$contactname1."', '".$contactphone1."', '".$contactemail1."', '".$contactname2."', '".$contactphone2."', '".$contactemail2."')";
$result = $db->query($query);
if ($result)
echo $db->affected_rows.' info inserted into database.';
$db->close();
?>