Jump to content

[SOLVED] can't spot the goof causing this error...


simcoweb

Recommended Posts

My eyes are bugging out trying to spot the error causing this

 

Parse error: parse error, unexpected T_STRING in /home2/wwwseat/public_html/buyers.php on line 48

 

Here's the code:

 

<?php

// include our config files
include 'db_config.inc';

// Turn on magic quotes to prevent SQL injection attacks
if(!get_magic_quotes_gpc())
set_magic_quotes_runtime(1);

// start processing
if (isset($_POST['submitted'])) {
  $errors = array();
  // validate the form input
if (empty($_POST['Name']) || empty($_POST['Email']) || empty($_POST['Phone'])) {
     $errors[] = "<font face='Verdana' size='2' color='#FF0000'>Your name, email address
        and daytime phone number are required. Please complete those fields and resubmit.</font>";
} else {
  $name = mysql_real_escape_string($_POST['Name']);
  $phone = mysql_real_escape_string($_POST['Phone']);
  $email = mysql_real_escape_string($_POST['Email']);
}
// validate email address format
if ($email) {
        if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {
            $errors[] = $email. " is not a valid email address. Please enter a valid email address.<br/>";
        }
    } else {
  // run query
  $address = mysql_real_escape_string($_POST['Address']);
  $city = mysql_real_escape_string($_POST['City']);
  $state = mysql_real_escape_string($_POST['State']);
  $zip = mysql_real_escape_string($_POST['Zip']);
  $country = mysql_real_escape_string($_POST['Country']);
  $moving = mysql_real_escape_string($_POST['When_moving']);
  $where = mysql_real_escape_string($_POST['Where_moving']);
  $price = mysql_real_escape_string($_POST['Price_range']);
  $bedrooms = mysql_real_escape_string($_POST['Number_bedrooms']);
  $sqft = mysql_real_escape_string($_POST['Sqaure_feet']);
  $comments = mysql_real_escape_string($_POST['Comments']);
  $date = date("F j, Y, g:i a");
  
$sql = "INSERT INTO buyers ( Name, Email, Phone, Address, City, State, Zip, Country, When_moving, Where_moving,
                           Price_range, Number_bedrooms, Square_feet, Comments, date) VALUES ('$name',
					   '$email', '$phone', '$address', '$state', '$zip', '$country', '$moving', '$where',
					   '$price', '$bedrooms', '$sqft', '$comments', '$date')";
					   
$results = mysql_query($sql) or die(mysql_error());
if (mysql_affected rows($dbc) == 1){

// Send the E-Mail
send_mails();

// redirect to confirmation page
  header("Location: confirmation.htm");
} else {
  header("Location: error.htm");
}
}
  
}
?>

 

I've commented out line 50 which is send_mails(); function to see if it was something a step ahead of line 48. But that didn't fix it.  Line 48 is:

 

if (mysql_affected rows($dbc) == 1){

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.