PDA

View Full Version : PHP form stoppped working properly


johnsa
02-26-2005, 02:46 PM
Have been using a simple php form mail. Has been working fine. Now it is causing a major problem. When you click on the submit button, this is followed by an acknowledged message in a new window. Now when you get the acknowledged message it includes this - "somebody goofed". This line is included in the php coding, however i do not understand what the code around this line refers to. The acknowledged message windows used to list the name of the person submitting the entry and their location in brackets. Now all you get are the brackets. The sendemail.php still sends the email off correctly, however not of the input data is sent. It sends date and time correctly, however none of the user input is sent. Part of the info sent by the sendemail.php includes town and country with the country being displayed in brackets. The sendemail.php only sends the brackets.

As far as i am aware nothing has changed with these files. I have replaced the ones in use witha saved copy, no change. I have deleted all the web site and upoaded in again, still same problem.

Can anyone please resolve this problem for me??

Below is the code i am using which has been adapted and modified from different sources as my ability is very limited.

Thanks for any help

Andy


SENDEMAIL.PHP file 1

<html>
<head>
<title>Sendemail Script</title>
</head>
<body>
<FONT FACE="Arial">
<!-- You must enter YOUR email address ($myemail shown below).
Then you should check (or modify) the link for the 'next page' (at the bottom) -->

<?php
$myemail = "andy@myweb.co.uk";

if (!isset($visitormail))
echo "Somebody Goofed $ip" ;

$todayis = date("l, F j, Y, g:i a") ;

$subject = "Prayers 4 U Mail" ;

$message = " $todayis [GMT] \n
From: $visitor \n
Location: $location ($visitormail)\n
Family: $family \n
";

$from = "From: $myemail\r\n";

if ($myemail != "")
mail($myemail, $subject, $message, $from, $location);

?>

<b><p align=center>
Date: <?php echo $todayis ?>
<br><br>
Your request has been received : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
<br>
<?php echo $ip ?>

<br><br><br>
Thankyou for your request,


</body>
</html>

-----------------------------------------------------------

File 2 with the input fields

<html>
<head>
<title>Email Form </title>
</head>
<body>
<FONT FACE="Arial">
<form method="POST" action="sendemail.php">

<!-- DO NOT change ANY of the php sections -->
<?php

<br>
<p align=right>Name (surname optional):<input type=text name="visitor" size="35">

<br>
<br>
<p align=right>Their town / city: <input type=text name="location" size="35">
<br><br>
Country: <input type=text name="visitormail" size="35">
<br><br>
Prayers for all the family - (surname & location) <input type=text name="family" size="35">
<br>
<FONT FACE="Arial"><p align=center> <input type=submit VALUE="Send Request">
<br>

</form>

</body>
</html>

IKLOP
02-26-2005, 03:23 PM
try adding this right after $myemail = "andy@myweb.co.uk"; $vistormail = $_POST['visitormail'];
$visitor = $_POST['visitor'];
$location = $_POST['location'];
$family = $_POST['family'];