Need urgent help with this PHP invitation script.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
eddie3002
Forum Newbie
Posts: 5
Joined: Thu Feb 19, 2009 10:28 am

Need urgent help with this PHP invitation script.

Post 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;


?>
mattpointblank
Forum Contributor
Posts: 304
Joined: Tue Dec 23, 2008 6:29 am

Re: Need urgent help with this PHP invitation script.

Post 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.
eddie3002
Forum Newbie
Posts: 5
Joined: Thu Feb 19, 2009 10:28 am

Re: Need urgent help with this PHP invitation script.

Post by eddie3002 »

When i hit the submit button nothing happens.
p3rk5
Forum Commoner
Posts: 34
Joined: Thu Jan 29, 2009 10:19 pm

Re: Need urgent help with this PHP invitation script.

Post 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>';
?>
eddie3002
Forum Newbie
Posts: 5
Joined: Thu Feb 19, 2009 10:28 am

Re: Need urgent help with this PHP invitation script.

Post 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
p3rk5
Forum Commoner
Posts: 34
Joined: Thu Jan 29, 2009 10:19 pm

Re: Need urgent help with this PHP invitation script.

Post by p3rk5 »

What's on line 36?
eddie3002
Forum Newbie
Posts: 5
Joined: Thu Feb 19, 2009 10:28 am

Re: Need urgent help with this PHP invitation script.

Post by eddie3002 »

its actually line 37
watson516
Forum Contributor
Posts: 198
Joined: Mon Mar 20, 2006 9:19 pm
Location: Hamilton, Ontario

Re: Need urgent help with this PHP invitation script.

Post 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.
eddie3002
Forum Newbie
Posts: 5
Joined: Thu Feb 19, 2009 10:28 am

Re: Need urgent help with this PHP invitation script.

Post 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">
?>
Post Reply