Could someone please test my script and tell me why I get this Warning.
Warning: Undefined variable: submit in D:\wwwroot\tellafriend.php on line 26
http://forums.belizeweb.com/tellafriend.php
Besides the warning it works pretty good.
Here is the code I am using.
PHP Code:
<?php
## Start Config ##
$sitename = "BelizeWeb";
$siteurl = "http://www.belizeweb.com";
$adminemail = "community@belizeweb.com";
$emailsubject = "First Ever Live Belizean Radio Station On The Internet";
$keywords = "Belize,Internet,Live,radio,"; // site keywords
$des = "BelizeWeb and Love FM has teamed up to bring you a Live Internet Broadcast of the Number One Radio station in Belize"; // description of site
$textcolor = "000000";
$color1 = "#517669";
$color2 = "#517669";
$color3 = "#D5EAD5";
$footer = "<br>";
$header = "<br><center><h1>Tell Your Friends About BelizeWeb</h1></center>";
## Put your message here between "" marks ##
$msg = "Live Internet Radio from Belize is finally here. Belize Telecommunications Ltd. and the number one radio station in Belize, Love FM have teamed up to bring you the first ever live Internet radio broadcast from Belize! visit [url]http://www.belizeweb.com[/url] and Listen to a special test broadcast. It's Love FM LIVE! Made possible by Belize Telecommunications Limited. For Telecommunications....THINK BTL!";
######### END CONFIG ####################
if ($submit){
// if email #1 and email #2 are empty, display error //
if ($email1 == "" || $email2 == "") {
echo "<font size=3 face=Arial><B>ERROR!!</b></font><font size='2' face='arial'>Either <b>your email</b> or your <b>friends email</b> email</b> was left out, please go back and fill in the entire form. Thank you!</font>";exit;}
// Start Message to friend
$message = "This message is from your friend : $email1
----------
$msg
";
mail("$email2","$emailsubject", $message, "From:$sitename <$adminemail>");
mail("$email3","$emailsubject", $message, "From:$sitename <$adminemail>");
mail("$email4","$emailsubject", $message, "From:$sitename <$adminemail>");
mail("$email5","$emailsubject", $message, "From:$sitename <$adminemail>");
?>
<!-- Start Thank you -->
<body bgcolor="<?=$color3?>" text="<?=$textcolor?>">
<TABLE WIDTH="400" ALIGN="CENTER">
<TR>
<TD WIDTH="45%"><DIV ALIGN="CENTER"><FONT SIZE="2" FACE="Arial"><B>Your Email:</B></FONT></DIV></TD>
<TD WIDTH="55%"><FONT FACE="Arial" SIZE="2"><?=$email1?></FONT></TD>
</TR>
<TR>
<TD WIDTH="45%"><DIV ALIGN="CENTER"><FONT SIZE="2" FACE="Arial"><B>Friends Email:</B></FONT></DIV></TD>
<TD WIDTH="55%"><FONT FACE="Arial" SIZE="2"><?=$email2?></FONT></TD>
</TR>
<TR>
<TD WIDTH="45%"><DIV ALIGN="CENTER"><FONT SIZE="2" FACE="Arial"><B>Friends Email:</B></FONT></DIV></TD>
<TD WIDTH="55%"><FONT FACE="Arial" SIZE="2"><?=$email3?></FONT></TD>
</TR>
<TR>
<TD WIDTH="45%"><DIV ALIGN="CENTER"><FONT SIZE="2" FACE="Arial"><B>Friends Email:</B></FONT></DIV></TD>
<TD WIDTH="55%"><FONT FACE="Arial" SIZE="2"><?=$email4?></FONT></TD>
</TR>
<TR>
<TD WIDTH="45%"><DIV ALIGN="CENTER"><FONT SIZE="2" FACE="Arial"><B>Friends Email:</B></FONT></DIV></TD>
<TD WIDTH="55%"><FONT FACE="Arial" SIZE="2"><?=$email5?></FONT></TD>
</TR>
</TABLE>
<font face="Arial" size="2"></form><br></font></div><div align="center">
<br></div>
<table width="600" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td><hr size="2"></td>
</tr>
</table>
<!-- End Thank you -->
<?php
}
## END OF SUBMIT ##
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> <?=$sitename?> </TITLE>
<META NAME="Keywords" CONTENT="<?=$keywords?>">
<META NAME="Description" CONTENT="<?=$des?>">
</HEAD>
<body bgcolor="<?=$color3?>" text="<?=$textcolor?>">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><?=$header?></td>
</tr>
</table>
<form action="<?=$PHP_SELF?>" method="post">
<table width="600" align="center">
<tr>
<td width="50%" bgcolor="<?=$color2?>"> <div align="right"><font size="2" face="Arial"><b>Your Email</b></font></div></td>
<td width="50%" bgcolor="<?=$color2?>"> <input type="text" name="email1" maxlength="100"></td>
</tr>
<tr>
<td width="50%" bgcolor="<?=$color2?>"><div align="right"><font size="2" face="Arial"><b>Friends Email 1</b></font></div></td>
<td width="50%" bgcolor="<?=$color2?>"><input type="text" name="email2" maxlength="100"></td>
</tr>
<TR>
<TD WIDTH="50%" BGCOLOR="<?=$color2?>"><DIV ALIGN="right"><FONT SIZE="2" FACE="Arial"><B>Friends Email 2</B></FONT></DIV></TD>
<TD WIDTH="50%" BGCOLOR="<?=$color2?>"> <INPUT TYPE="text" NAME="email3" MAXLENGTH="100"></TD>
</TR>
<TR>
<TD WIDTH="50%" BGCOLOR="<?=$color2?>"><DIV ALIGN="right"><FONT SIZE="2" FACE="Arial"><B>Friends Email 3</B></FONT></DIV></TD>
<TD WIDTH="50%" BGCOLOR="<?=$color2?>"><INPUT TYPE="text" NAME="email4" MAXLENGTH="100"></TD>
</TR>
<TR>
<TD WIDTH="50%" BGCOLOR="<?=$color2?>"><DIV ALIGN="right"><FONT SIZE="2" FACE="Arial"><B>Friends Email 4</B></FONT></DIV></TD>
<TD WIDTH="50%" BGCOLOR="<?=$color2?>"><INPUT TYPE="text" NAME="email5" MAXLENGTH="100"> </TD>
</TR>
<tr>
<td width="50%"> </td><td width="50%"><input type="submit" name="submit" value="SUBMIT"></td>
</tr>
</table>
</form>
</body>
</html>
Thanks.
Bookmarks