Page 1 of 1

Need urgent help with this PHP invitation script.

Posted: Thu Feb 19, 2009 10:35 am
by eddie3002
I need help getting this invitation form to work I have included the HTML code and also the PHP code. All help is greatly appreciated.

<----here is the html form code------>
<FORM METHOD="post" ACTION="submit_mail.php" onsubmit="return checkform();" name="frm">
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="31%" class="main-txt">Email Addresses </td>
<td width="5%"><div align="center">:</div></td>
<td width="64%"><input name="host_name2" type="text" class="form-input" id="host_name" size="39" /></td>
</tr>
<tr>
<td colspan="3" class="main-txt" height="10"></td>
</tr>
<tr>
<td width="31%" class="main-txt">Host Name </td>
<td width="5%"><div align="center">:</div></td>
<td width="64%"><input name="host_name" type="text" class="form-input" id="Host Name " size="39" /></td>
</tr>
<tr>
<td colspan="3" class="main-txt" height="10"></td>
</tr>
<tr>
<td class="main-txt">Telephone</td>
<td><div align="center">:</div></td>
<td><input name="telephone" type="text" class="form-input" id="Telephone" size="39" /></td>
</tr>
<tr>
<td colspan="3" class="main-txt" height="10"></td>
</tr>
<tr>
<td class="main-txt">Address<br /></td>
<td><div align="center">:</div></td>
<td><textarea name="address" cols="35" rows="5" class="form-input2" id="textarea"></textarea></td>
</tr>
<tr>
<td colspan="3" class="main-txt" height="10"></td>
</tr>
<tr>
<td class="main-txt">City<br /></td>
<td><div align="center">:</div></td>
<td><input name="city" type="text" class="form-input" id="City" size="39" /></td>
</tr>
<tr>
<td colspan="3" class="main-txt" height="10"></td>
</tr>
<tr>
<td class="main-txt">State</td>
<td><div align="center">:</div></td>
<td><input name="state" type="text" class="form-input" id="State" size="39" /></td>
</tr>
<tr>
<td colspan="3" class="main-txt" height="10"></td>
</tr>
<tr>
<td class="main-txt">Zipcode</td>
<td><div align="center">:</div></td>
<td><input name="zipcode" type="text" class="form-input" id="Zipcode" size="39" /></td>
</tr>
<tr>
<td colspan="3" class="main-txt" height="10"></td>
</tr>
<tr>
<td class="main-txt">Party Date</td>
<td><div align="center">:</div></td>
<td><input name="party_date" type="text" class="form-input" id="Party Date" size="39" /></td>
</tr>
<tr>
<td colspan="3" class="main-txt" height="10"></td>
</tr>
<tr>
<td class="main-txt">Party Time</td>
<td><div align="center">:</div></td>
<td><input name="party_time" type="text" class="form-input" id="Party Time" size="39" /></td>
</tr>
<tr>
<td colspan="3" class="main-txt" height="10"></td>
</tr>


<tr>
<td class="main-txt">Message</td>
<td><div align="center">:</div></td>
<td><label>
<textarea name="message" cols="35" rows="5" class="form-input2" id="Party Address"></textarea>
</label></td>
</tr>
<tr>
<td colspan="3" class="main-txt" height="10"></td>
</tr>
<tr>
<td colspan="3" class="main-txt" height="15"></td>
</tr>
<tr>
<td class="main-txt">&nbsp;</td>
<td>&nbsp;</td>
<td><label><input type="image" src="gold/send-btrn-gold.gif" width="208" height="77" /></label></td>
</tr>
<!-- <tr>
<td colspan="3" class="main-txt" height="15"></td>
</tr> -->
</table>
</FORM>

<----here is the PHP code------>
<?
$email_ids=explode(",",$_POST['email']);
for($i=0;$i<=count($email_ids)-1;$i++)
{
$to = $email_ids[$i];

$from = "info@vintagesportscardmemorabilia.com";
$subject = "Invitaion - vintagesportscardmemorabilia.com";
$sub2 = "Someone has sent invitation";

$msg ="Hello,\n\nYou have been invited to join the vintage Sports party. The details of the invitation are as follows:\n\n";
$msg.="Host Name : ".$_POST['host_name']."\n";
$msg.="Telephone : ".$_POST['telephone']."\n";
$msg.="Address : ".$_POST['address']."\n";
$msg.="City : ".$_POST['city']."\n";
$msg.="State : ".$_POST['state']."\n";
$msg.="Zipcode : ".$_POST['zipcode']."\n";
$msg.="Party Date : ".$_POST['party_date']."\n";
$msg.="Party Time : ".$_POST['party_time']."\n";
$msg.="Message : ".$_POST['message']."\n";
$msg.="\n\nThanks\nvintagesportscardmemorabilia.com\nhttp://vintagesportscardmemorabilia.com/";

$headers="MIME-Version: 1.0\r\n";
$headers.="Content-type: text/plain; charset=iso-8859-1\r\n";
$headers.="From: $from\r\n\n";
$msgg = "Someone has sent invitation to $to,\n$msg";
mail($to, $subject, $msg, $headers);
@mail("eddie3002@yahoo.com",$sub2,$msgg, $headers);
}

header("location:send-invitations-thanks.html");
exit;


?>

Re: Need urgent help with this PHP invitation script.

Posted: Thu Feb 19, 2009 10:47 am
by mattpointblank
Nobody is going to debug hundreds of lines of your code - tell us the problem and any error messages first please.

Also, use the code tags to display your code nicely, eg:

[syntax=php]php code goes here[/syntax]

[syntax=php]general code (like html) goes here[/syntax]

etc.

Re: Need urgent help with this PHP invitation script.

Posted: Thu Feb 19, 2009 11:20 am
by eddie3002
When i hit the submit button nothing happens.

Re: Need urgent help with this PHP invitation script.

Posted: Thu Feb 19, 2009 11:35 am
by p3rk5
submit_mail.php:

Code: Select all

 
<?
$submit = $_POST['submit'];
if ($submit) { //if submit is set, send mail
$email_ids=explode(",",$_POST['email']);
for($i=0;$i<=count($email_ids)-1;$i++)
{
$to = $email_ids[$i];
 
$from = "info@vintagesportscardmemorabilia.com";
$subject = "Invitaion - vintagesportscardmemorabilia.com";
$sub2 = "Someone has sent invitation";
 
$msg ="Hello,\n\nYou have been invited to join the vintage Sports party. The details of the invitation are as follows:\n\n";
$msg.="Host Name : ".$_POST['host_name']."\n";
$msg.="Telephone : ".$_POST['telephone']."\n";
$msg.="Address : ".$_POST['address']."\n";
$msg.="City : ".$_POST['city']."\n";
$msg.="State : ".$_POST['state']."\n";
$msg.="Zipcode : ".$_POST['zipcode']."\n";
$msg.="Party Date : ".$_POST['party_date']."\n";
$msg.="Party Time : ".$_POST['party_time']."\n";
$msg.="Message : ".$_POST['message']."\n";
$msg.="\n\nThanks\nvintagesportscardmemorabilia.com\nhttp://vintagesportscardmemorabilia.com/";
 
$headers="MIME-Version: 1.0\r\n";
$headers.="Content-type: text/plain; charset=iso-8859-1\r\n";
$headers.="From: $from\r\n\n";
$msgg = "Someone has sent invitation to $to,\n$msg";
mail($to, $subject, $msg, $headers);
@mail("eddie3002@yahoo.com",$sub2,$msgg, $headers);
}
 
header("location:send-invitations-thanks.html");
exit;
} else { //if submit is not pressed, display form
echo '<FORM METHOD="post" ACTION="submit_mail.php" onsubmit="return checkform();" name="frm">
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="31%" class="main-txt">Email Addresses </td>
<td width="5%"><div align="center">:</div></td>
<td width="64%"><input name="host_name2" type="text" class="form-input" id="host_name" size="39" /></td>
</tr>
<tr>
<td colspan="3" class="main-txt" height="10"></td>
</tr>
<tr>
<td width="31%" class="main-txt">Host Name </td>
<td width="5%"><div align="center">:</div></td>
<td width="64%"><input name="host_name" type="text" class="form-input" id="Host Name " size="39" /></td>
</tr>
<tr>
<td colspan="3" class="main-txt" height="10"></td>
</tr>
<tr>
<td class="main-txt">Telephone</td>
<td><div align="center">:</div></td>
<td><input name="telephone" type="text" class="form-input" id="Telephone" size="39" /></td>
</tr>
<tr>
<td colspan="3" class="main-txt" height="10"></td>
</tr>
<tr>
<td class="main-txt">Address<br /></td>
<td><div align="center">:</div></td>
<td><textarea name="address" cols="35" rows="5" class="form-input2" id="textarea"></textarea></td>
</tr>
<tr>
<td colspan="3" class="main-txt" height="10"></td>
</tr>
<tr>
<td class="main-txt">City<br /></td>
<td><div align="center">:</div></td>
<td><input name="city" type="text" class="form-input" id="City" size="39" /></td>
</tr>
<tr>
<td colspan="3" class="main-txt" height="10"></td>
</tr>
<tr>
<td class="main-txt">State</td>
<td><div align="center">:</div></td>
<td><input name="state" type="text" class="form-input" id="State" size="39" /></td>
</tr>
<tr>
<td colspan="3" class="main-txt" height="10"></td>
</tr>
<tr>
<td class="main-txt">Zipcode</td>
<td><div align="center">:</div></td>
<td><input name="zipcode" type="text" class="form-input" id="Zipcode" size="39" /></td>
</tr>
<tr>
<td colspan="3" class="main-txt" height="10"></td>
</tr>
<tr>
<td class="main-txt">Party Date</td>
<td><div align="center">:</div></td>
<td><input name="party_date" type="text" class="form-input" id="Party Date" size="39" /></td>
</tr>
<tr>
<td colspan="3" class="main-txt" height="10"></td>
</tr>
<tr>
<td class="main-txt">Party Time</td>
<td><div align="center">:</div></td>
<td><input name="party_time" type="text" class="form-input" id="Party Time" size="39" /></td>
</tr>
<tr>
<td colspan="3" class="main-txt" height="10"></td>
</tr>
 
 
<tr>
<td class="main-txt">Message</td>
<td><div align="center">:</div></td>
<td><label>
<textarea name="message" cols="35" rows="5" class="form-input2" id="Party Address"></textarea>
</label></td>
</tr>
<tr>
<td colspan="3" class="main-txt" height="10"></td>
</tr>
<tr>
<td colspan="3" class="main-txt" height="15"></td>
</tr>
<tr>
<td class="main-txt">&nbsp;</td>
<td>&nbsp;</td>
<td><label><input type="image" src="gold/send-btrn-gold.gif" width="208" height="77" name="submit" /></label></td>
</tr>
<!-- <tr>
<td colspan="3" class="main-txt" height="15"></td>
</tr> -->
</table>
</FORM>';
?>

Re: Need urgent help with this PHP invitation script.

Posted: Thu Feb 19, 2009 12:25 pm
by eddie3002
Thanks for the help. Now im getting the following message

Parse error: syntax error, unexpected '<' in /home/kgp/public_html/submit_mail.php on line 36

Re: Need urgent help with this PHP invitation script.

Posted: Thu Feb 19, 2009 12:33 pm
by p3rk5
What's on line 36?

Re: Need urgent help with this PHP invitation script.

Posted: Thu Feb 19, 2009 12:37 pm
by eddie3002
its actually line 37

Re: Need urgent help with this PHP invitation script.

Posted: Thu Feb 19, 2009 12:45 pm
by watson516
If you want to echo that much html, you might want to put in a closing php tag and then an opening one after all of the html is done. Makes things much easier.

You might also want to use normal php tags instead.

The if statement isn't closed at the end.

Re: Need urgent help with this PHP invitation script.

Posted: Thu Feb 19, 2009 12:51 pm
by eddie3002
I have 2 pages a PHP file and a seperate HTML file this is my PHP file

<?
$submit = $_POST['submit'];
if ($submit) { //if submit is set, send mail
$email_ids=explode(",",$_POST['email']);
for($i=0;$i<=count($email_ids)-1;$i++)
{
$to = $email_ids[$i];

$from = "info@vintagesportscardmemorabilia.com";
$subject = "Invitaion - vintagesportscardmemorabilia.com";
$sub2 = "Someone has sent invitation";

$msg ="Hello,\n\nYou have been invited to join the vintage sports party. The details of the invitation are as follows:\n\n";
$msg.="Host Name : ".$_POST['host_name']."\n";
$msg.="Telephone : ".$_POST['telephone']."\n";
$msg.="Address : ".$_POST['address']."\n";
$msg.="City : ".$_POST['city']."\n";
$msg.="State : ".$_POST['state']."\n";
$msg.="Zipcode : ".$_POST['zipcode']."\n";
$msg.="Party Date : ".$_POST['party_date']."\n";
$msg.="Party Time : ".$_POST['party_time']."\n";
$msg.="Message : ".$_POST['message']."\n";
$msg.="\n\nThanks\nVintageSportsCardMemorabilia.com\nhttp://vintagesportscardmemorabilia.com/";

$headers="MIME-Version: 1.0\r\n";
$headers.="Content-type: text/plain; charset=iso-8859-1\r\n";
$headers.="From: $from\r\n\n";
$msgg = "Someone has sent invitation to $to,\n$msg";
mail($to, $subject, $msg, $headers);
@mail("eddie3002@yahoo.com",$sub2,$msgg, $headers);
}

header("location:send-invitations-thanks.html");
exit;
} else { //if submit is not pressed, display form
echo '<FORM METHOD="POST" ACTION="submit_mail.php" onsubmit="return checkform(); name="frm">
?>