MrTbone
04-06-2007, 05:15 PM
Yep another newbie to PHP ..sorry :confused:
I have read through quite a few of the threads on this forum regarding PHP forms and how to make them work.This has got me to the stage I am at now...sad eh? I would appreciate any help all you experts out there can offer. My site has a form which when filled out and the submit button hit gives me the following error message , under which appears the message for the user.
#!/usr/local/bin/php
Notice: Undefined variable: msg in e:\domains\s\mysite.co.uk\user\htdocs\contact.php on line 11
my PHP script is below, I have changed my actual email in the script to myemail@somewhere.com and in the above error text I have replaced my actual domain with mysite.co.uk
thanks in advance to anybody taking the time to read this I'm sure from looking at all the other threads you must be tired of helping us newbies. Oneday I hope to be answering stuff for others....oh hum I can dream can't I
my PHP script
#!/usr/local/bin/php
<?php
/* set up to handle either post or get form variables */
if (count($_POST)>0) $response = $_POST;
else $response = $_GET;
/* iterate through form variables and display them as key: value pairs */
foreach ($response as $key => $val)
{
$msg .= "$key: $val";
$msg .= "\r\n";
}
/* strip slashes from characters like apostrophe */
$msg = stripslashes($msg);
/* send the message */
mail("myemail@somewhere.com", "form response", $msg);
?>
<html>
<head>
<title>survey handler</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#339900" text="#000000">
<p>
<center>
<p> </p>
<p> </p>
<p> </p>
<p><font color="#FFCC99" size="4" face="Comic Sans MS"><b><font size="5">Thank
you for your enquiry, we will be in touch.</font></b></font></p>
<p><font size="5"><b><font color="#FFCC99" face="Comic Sans MS">Have a nice
day!</font></b> </font></p>
</center>
</p>
</body>
</html>
many thanks
MrTbone
I have read through quite a few of the threads on this forum regarding PHP forms and how to make them work.This has got me to the stage I am at now...sad eh? I would appreciate any help all you experts out there can offer. My site has a form which when filled out and the submit button hit gives me the following error message , under which appears the message for the user.
#!/usr/local/bin/php
Notice: Undefined variable: msg in e:\domains\s\mysite.co.uk\user\htdocs\contact.php on line 11
my PHP script is below, I have changed my actual email in the script to myemail@somewhere.com and in the above error text I have replaced my actual domain with mysite.co.uk
thanks in advance to anybody taking the time to read this I'm sure from looking at all the other threads you must be tired of helping us newbies. Oneday I hope to be answering stuff for others....oh hum I can dream can't I
my PHP script
#!/usr/local/bin/php
<?php
/* set up to handle either post or get form variables */
if (count($_POST)>0) $response = $_POST;
else $response = $_GET;
/* iterate through form variables and display them as key: value pairs */
foreach ($response as $key => $val)
{
$msg .= "$key: $val";
$msg .= "\r\n";
}
/* strip slashes from characters like apostrophe */
$msg = stripslashes($msg);
/* send the message */
mail("myemail@somewhere.com", "form response", $msg);
?>
<html>
<head>
<title>survey handler</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#339900" text="#000000">
<p>
<center>
<p> </p>
<p> </p>
<p> </p>
<p><font color="#FFCC99" size="4" face="Comic Sans MS"><b><font size="5">Thank
you for your enquiry, we will be in touch.</font></b></font></p>
<p><font size="5"><b><font color="#FFCC99" face="Comic Sans MS">Have a nice
day!</font></b> </font></p>
</center>
</p>
</body>
</html>
many thanks
MrTbone