Hi all, 

I used this piece of code and it worked very well. so
I used it on my web site. I was, therefore, shocked
when I tried it yesterday and it did not respond. I am
not very good in php and all my attempts to 'revive'
this code have failed. Any help is warmly welcome.

Thanks in advance and below is the code (with html -
within the <body> </body> tags.

DK


<?php
$tellnumber = "5";
$subject = "I thought you might like this site";
$message = "Checkout this site
http://www.mywebsite.com, I thought you might like
it.";
$thankyouurl = "http://www.mywebsite.com/thanks.php";;

if($submitform) {

$num=0;
while($num < $tellnumber) {
$num++;
$temail = "femail"."$num";
$tname = "fname"."$num";

if($$tname OR $$temail) {
if(!$$tname) {
$error .= "Missing Friends Name,  Friend $num<BR>";
}
if(!$$temail) {
$error .= "Missing Friends Email,  Friend $num<BR>";
}

}
if($$temail) {
if(!ereg("@",$$temail)) { $error .= "Invalid Email
Address, Friend $num<BR>"; }
if(!ereg("\.",$$temail)) { $error .= "Invalid Email
Address, Friend $num<BR>"; }
}
}
if(!$tname) {
$error .= "Missing your name<BR>";
}
if(!ereg("@",$email)) { $error .= "Invalid Email
Address<BR>"; }
if(!ereg("\.",$email)) { $error .= "Invalid Email
Address<BR>"; }

if($error) {
?>
<P><CENTER><TABLE BORDER="0" CELLSPACING="0"
CELLPADDING="0">
  <TR>
    <TD WIDTH="100%" BGCOLOR="#004080">
    <TABLE WIDTH="394" BORDER="0" CELLSPACING="1"
CELLPADDING="2">
      <TR>
        <TD WIDTH="26%" BGCOLOR="#004080">
        <B><FONT COLOR="#ffffff" SIZE="-1"
FACE="Verdana">Error</FONT></B></TD>
      </TR>
      <TR>
        <TD WIDTH="26%" BGCOLOR="#ffffff">
        <FONT COLOR="#000000" SIZE="-1"
FACE="Verdana"><?php echo $error; ?></FONT></TD> 
      </TR>
    </TABLE></TD>
  </TR>
</TABLE></CENTER>

</BODY></HTML>
<?php
exit();
}


$num=0;
while($num < $tellnumber) {
$num++;
$temail = "femail"."$num";
$tname = "fname"."$num";
$then = $$tname;
if($$temail AND $$tname) {
mail($$temail,"$subject","
Hi, $then

$message

Kind regards from,
$name


","From: $name <$email>");
}

}

header("Location: $thankyouurl");
exit();

} else {

$num=0;
while($num < $tellnumber) {
$num++;
$theboxes .= " <TR>
        <TD WIDTH=\"49%\" BGCOLOR=\"#ffffff\">
        <P><CENTER><B><FONT COLOR=\"#000000\"
SIZE=\"-1\"
FACE=\"Verdana\">$num</FONT></B></CENTER></TD>
        <TD WIDTH=\"26%\" BGCOLOR=\"#ffffff\">
        <P><CENTER><INPUT NAME=\"fname$num\"
TYPE=\"text\" SIZE=\"25\"></CENTER></TD>
        <TD WIDTH=\"25%\" BGCOLOR=\"#ffffff\">
        <INPUT NAME=\"femail$num\" TYPE=\"text\"
SIZE=\"25\">
</TD> 
      </TR>";
}


?>
<P><CENTER>
    <FONT FACE="Verdana"><B><font color="#CCCCCC">Tell
your friends about mywebsite.com!</font></B></FONT>
<br>
    <img src="images/bars/Top_image.jpg" width="400"
height="5"> 
  </CENTER></P>
<FORM ACTION="share.php"
METHOD="POST"><P><CENTER><TABLE BORDER="0"
CELLSPACING="0" 
CELLPADDING="0">
  <TR>
    <TD WIDTH="100%" BGCOLOR="#004080">
    <TABLE WIDTH="394" BORDER="0" CELLSPACING="1"
CELLPADDING="2">
      <TR>
        <TD WIDTH="26%" BGCOLOR="#004080">
        <P><CENTER><B><FONT COLOR="#ffffff" SIZE="-1"
FACE="Verdana">Your Name</FONT></B></CENTER></TD>
        <TD WIDTH="25%">
        <P><CENTER><B><FONT COLOR="#ffffff" SIZE="-1"
FACE="Verdana">Your Email</FONT></B></CENTER></TD>
      </TR>
      <TR>
        <TD WIDTH="26%" BGCOLOR="#ffffff">
        <P><CENTER><INPUT NAME="name" TYPE="text"
SIZE="25"></CENTER></TD>
        <TD WIDTH="25%" BGCOLOR="#ffffff">
        <INPUT NAME="email" TYPE="text" SIZE="25">
</TD>
      </TR>
    </TABLE></TD>
  </TR>
</TABLE></CENTER></P><P><CENTER><TABLE BORDER="0"
CELLSPACING="0" CELLPADDING="0">
  <TR>
    <TD WIDTH="100%" BGCOLOR="#004080">
    <TABLE WIDTH="394" BORDER="0" CELLSPACING="1"
CELLPADDING="2">
      <TR>
        <TD WIDTH="49%" BGCOLOR="#004080"></TD>
        <TD WIDTH="26%" BGCOLOR="#004080">
        <P><CENTER><B><FONT COLOR="#ffffff" SIZE="-1"
FACE="Verdana">Friend's Name</FONT></B></CENTER></TD>
        <TD WIDTH="25%">
        <P><CENTER><B><FONT COLOR="#ffffff" SIZE="-1"
FACE="Verdana">Friend's Email</FONT></B></CENTER></TD>

      </TR><?php echo $theboxes; ?></TABLE></TD>
  </TR>
</TABLE></CENTER></P>
<P><CENTER><INPUT NAME="submitform" TYPE="submit"
VALUE="Submit"></FORM></CENTER> 
<p align="center"><img src="images/mywebsite.jpg"
width="394" height="57"></p>
</BODY></HTML>
<?php
exit();

}

?>

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get to your groups with one click. Know instantly when new email arrives
http://us.click.yahoo.com/.7bhrC/MGxNAA/yQLSAA/HKFolB/TM
--------------------------------------------------------------------~-> 

Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to