My first php and a problem.

From: alfredo (alfredo_at_discussions.microsoft.com)
Date: 02/03/05


Date: Wed, 2 Feb 2005 22:33:02 -0800

Hi,

I got a php script for a "tell a friend form", tested it and everything went
fine. Then I adapted it to my site, tested and everything went fine again.
But suddenly the thing stopped working and I suppose it was me who
accidentally erased or changed something.

When I click on "submit" I get a "500 internal server error"

Here's the code in question:

html form:

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Refer a friend to mysite</title>
</head>

<body>
<html>
<head>
<title>Refer a friend to mysite</title>
<script language="javascript">
<!--

function reset() {
document.refer.name.value="";
document.refer.email.value="";
document.refer.friendmail1.value="";
document.refer.friendmail2.value="";
}

function validate() {

if (document.refer.friendmail1.value.length==0) {
alert("please enter your friend's email address");
return false;
}

if (document.refer.email.value.length==0) {
alert("please enter your email address");
return false;
}
if (document.refer.name.value.length==0) {
alert("please enter your name");
return false;
}

document.refer.submit()
return true;
}

//-->
</script>
</head>
<body onload="reset()" topmargin="0" leftmargin="0">
<center>
</center>
<table width="450" cellpadding="0" cellspacing="0" align="center">
<tr valign="top">
<td valign="middle" align="center">

<form name="refer" action="refer.php" method="post" onsubmit="return
checkfields()">

                                                        <table border="0" width="370" cellspacing="0" cellpadding="2"
style="font-family: Verdana; font-size: 8pt">
                                                                <tr>
                                                                        <td width="181">Your name:
                                                                        </td>
                                                                        <td width="181">Your email:</td>
                                                                </tr>
                                                                <tr>
                                                                        <td width="181">
                                                                        <input type="text" name="name" size="25"></td>
                                                                        <td width="181">
                                                                        
                                                                        <input type="text" name="email" size="25"></td>
                                                                </tr>
                                                                <tr>
                                                                        <td width="366" colspan="2"> </td>
                                                                </tr>
                                                                <tr>
                                                                        <td width="183">Friend's email</td>
                                                                        <td width="183">Another friend's email</td>
                                                                </tr>
                                                                <tr>
                                                                        <td width="183">
                                                                        <input type="text" name="friendmail1" size="25"></td>
                                                                        <td width="183">
                                                                        <input type="text" name="friendmail2" size="25"></td>
                                                                </tr>
                                                                <tr>
                                                                        <td width="366" colspan="2"> </td>
                                                                </tr>
                                                                <tr>
                                                                        <td width="181" align="center">
                                                                        <input type="submit" value="Submit" name="B3" style="font-family:
Verdana; font-size: 8pt"></td>
                                                                        <td width="181" align="center">
                                                                        <input type="reset" value="Reset" name="B4" style="font-family:
Verdana; font-size: 8pt"></td>
                                                                </tr>
                                                        </table></form>

                                                                                                        </body>

</html>

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

php script: (of course mysite.com is not my real domain, I changed it,
didn't want to spam)

<?PHP

strip_tags($friendmail1);
strip_tags($friendmail2);
strip_tags($email);
strip_tags($name);

$emailto = "myemail@mysite.com";

$esubject = "Page Referred";

$emailtext = "
".$name." / ".$email."

Referred People

".$friendmail1."
".$friendmail2."

";
@mail("$emailto", $esubject, $emailtext, "From: $email");

$thankyoupage = "thankyou.htm";

$tsubject = "A great site";

 $ttext = "
Hi,

A friend or colleague of yours, ".$name.", whose email address is ".$email."
thought you may like to visit our site. ".$name." has used a form on
mysite.com to send you this email.

http://www.mysite.com
";
@mail("$friendmail1 $friendmail2 $friendmail3", $tsubject, $ttext, "FROM:
$email");

header("Location: $thankyoupage");
exit;
?>

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

Thanks for your time,

                                    Alfredo



etc
... With neither quill nor qualm,... > What's this "friend" thing I keep hearing about? ... > "friend", I would have to refrain from talking about HTML, CSS, or the web ...
(alt.html)
  • [fedora] Apache and PHP
    ... I have a Fedora 1 box running Apache 2.0.50. ... A friend of mine has his homepage on my server and he have a PHP guestbook. ... guestbook the php script writes that to a file called guestbook.txt. ... This work just fine but he is worried by the permissions on the file. ...
    (Fedora)
  • Newbie Q: looking for PHP-aware HTML editor
    ... I was recently approached by a friend who maintains a small web site -- ... manipulating all the nested tags that are needed to accomplish ... HTML editing using FrontPage -- and with my new version of those pages, ...
    (comp.lang.php)
  • Re: html question
    ... > I sent a friend an email that has colors and a graphic image in it. ... > assume this must mean it's HTML. ... image of the message after composing the message in some other program. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Stumped:: web HTML. Caution, may be OT.
    ... mozilla, firefox, a couple others. ... My friend was using IE; ... I've never learned an HTML editors because of the ... Gary Kline kline@xxxxxxxxxxx www.thought.org Public Service Unix ...
    (freebsd-questions)
  • Relevant Pages