Hi there, I'm doing a college project with a website. I'm having trouble trying to get user information from a form and add it to the database and at the same time I want to send out a confirmation e-mail to teh customer but keep getting errors from my server. The first line is ok, thats for my server to parse php.
#!/usr/local/bin/php
if($Submit)
{
$link = mysql_connect("mysql.internal", "baz", "rREfp2t4");
if ( ! $link )
die( "Couldn't connect to Database" );
$db = baz;
mysql_select_db( $db ) or die ( "Couldn't open $db: ".mysql_error() );
// if customers details have been entered
$check = True;
$done = False;
// confirm all details entered
if ($_POST["fname"] =="" or $_POST["lname"]=="" or $_POST["Address1"]=="" or $_POST["Address2"]=="" or $_POST["Address3"]=="" or $_POST["Address4"]=="" or
$_POST["phoneNum"]=="" or $_POST["mobNum"]=="" or $_POST["email"]=="")
{
echo '
One or more of the fields were left blank. Please fill them as we need all of the details in order to send out an engineer.
//These are functions to ensure that correct details have been entered into each field
if($_POST["fname"] != "")
{
if (eregi("[[:alpha:]]", $_POST["fname"]))
{
$check = True;
}
else
{
echo '
You appear to have entered the details in the First Name field incorrectly. Please try again
You have entered and invalid Phone Number. Please enter the full international number. For example, for the number +353 (0)87 1234567, enter 353871234567. Please try again
Thank you! We will be in contact to make an appointment within 24 hours!
';
//Email the receipt to the customer.
$custMessage="Thank you $_POST["fname"] we will be in contact about a callout to:
$_POST["Address1"]
$_POST["Address2"]
$_POST["Address3"]
$_POST["Address4"]";
$staffMessage="Customer Looking for callout ASAP to:
$_POST["fname"] $_POST["lname"]
$_POST["Address1"]
$_POST["Address2"]
$_POST["Address3"]
$_POST["Address4"]
$_POST["phoneNum"]
$_POST["mobNum"]
$_POST["email"]";
Figured it out, was simply that my sql server needed me to concatonaate the strings being entered into the database with the "." operator to stop the server confusing all of the " operators with each other...