What is wrong with this code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is driving me nuts.  I am getting blank emails and the only information 
that is being passed to MySQL is the IP address.

Can someone tell me what is wrong with this?

<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
 <div id="important" style="visibility:hidden;">
   <p>If you can see this, it's an anti-spam measure.  Please don't
   fill in the address field.</p>
   <label for="address">Address</label>
   <input type="text" name="address" id="address" /></div>

   <label for="name">Name:</label>
   <input name="name" type="text" /><br />
   <label for="email">Email Address:</label>
<input name="email" type="text" />
<br />
<label for="name">Comments:</label>
<textarea name="comments" cols="50" rows=""></textarea>
<input name="submit" type="button" value="submit" /></form>

<?php

// Receiving variables


$ip= $_SERVER['REMOTE_ADDR'];
$name = $_POST['name'];
$email = $_POST['email'];
$comments = $_POST['comments'];

//spam filter, do not touch
 if ($_POST['address'] != '' ){


die("Changed field");

    }

//endo fo spam filter

$header = "From: $email\n"
. "Reply-To: $email\n";
$subject = "Response from Assessment Lawyer";
$email_to = "sanitized";
$message = "name: $name\n"
. "email: $email\n"
. "comments: $comments\n"
."Visitors IP: $ip\n";
mail($email_to, $subject, $message, $header);




$dbc= mysqli_connect(sanitized,sanitized,sanitized,sanitized)// I have 
removed the actual information, but it was connecting!
or die('Could not connect to db');

$query = "INSERT INTO sanitized VALUES(0,'$name', 
'$email','$comments','$ip')";

$result = mysqli_query($dbc, $query)
or die('Error querying database.');



            mysqli_close($dbc);

echo 'Thank you $name for submitting your inquiry!<br />';
echo 'You have supplied the following information:<br />';
echo 'Name: $name <br />';
echo 'Email Address: $email <br />';
echo 'Comments: $comments';

?> 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux