Forum Moderators: coopster
I have robbed and tried so much code now that I am lost and don't know where to begin. I copy here the most recent borrowings from another user on this site (thank you for contributions) which I believe should solve some of the problems.
The discrepency is that IF Global variables are turned off, by database connected pages shouldn't work, should they?
I have stripped everything out here and included the original .htm file:
<form method="post" action="question.php">
Requested by: <input type="text" name="by" size="40">
Address: <input type="text" name="address" size="40">
County: <input type="text" name="county" size="40">
Postcode: <input type="text" name="postcode" size="40">
Email: <input type="text" name="email" size="40">
Question or Comments: <input type="text" name="comments" size="40">
<input type="submit" name="Ask" value="Ask our Expert!">
</form>
<?php
echo "<PRE>_POST: ";
print_r ($_POST);
echo "</PRE>";
$today = date("F j, Y, g:i a");
//Get the contents of form
$by = $_POST['by'];
$address = $_POST['address'];
$county = $_POST['county'];
$country = $_POST['country'];
$postcode = $_POST['postcode'];
$email = $_POST['email'];
$comments = $_POST['comments'];
$message = "Revision request submitted on $today\n
\n
Requested by: $by\n
Address: $address\n
County: $county\n
Country: $country\n
postcode: $postcode\n
Email: $email\n
\n
Comments: $comments \n";
$to = "name@domain.com";
$from = "name@domain.com";
$subject = "Revision Request - $today";
mail($to,$subject,$message);
print "done!";
?>
AND it doesn't work! ARGGGHHH
The site is a charity site and I am trapped doing more work on it that paying clients, as I haven't scripted in PHP before and am steadily going mad. :(
Can anyone see what is going on?
I will happily send chocolates to whoever can point me in the right direction.
Cheers
Betty
[edited by: jatar_k at 4:37 pm (utc) on April 11, 2003]
[edit reason] trimmed out unnecessary html [/edit]
<?
echo "<PRE>_POST: ";
print_r ($_POST);
echo "</PRE>";
$today = date("F j, Y, g:i a");
$message = "Revision request submitted on $today\r\n\r\n";
$message .= "Requested by: $_POST['by']\r\n";
$message .= "Address: $_POST['address']\r\n";
$message .= "County: $_POST['county']\r\n";
// there isn't even a country field in the html you posted but I left it in
$message .= "Country: $_POST['country']\r\n";
$message .= "postcode: $_POST['postcode']\r\n";
$message .= "Email: $_POST['email']\r\n\r\n";
$message .= "Comments: $_POST['comments'] \r\n";
$to = "name@domain.com";
$from = "From: $_POST['email']\r\n";
$subject = "Revision Request - $today";
mail [php.net]($to,$subject,$message,$from);
print "done!";
?>
I switched from \n to \r\n since, I am guessing, you will use an ms mail client I don't think \n works they use \r\n for newlines.