PHP Help!!!!!
Posted: Wed Apr 22, 2009 8:31 pm
Hi
my first post to this forum so be nice to me
my skills in php are fairly limited and ive been working on building a simple form that has form processing using php. It worked fine in testing, the emails came through to me but since i have published this to the web there have been complains from my client that not all the emails are actually coming through.
I did all the obvious checks and tested it myself, yep it still works, checked junk folder, made sure the user actually did click on the submit button, tried in in different web browsers.. so im a bit stumped as to what this problem is...
one reason i thought of was dodgy code, so ive attached below the php code i have written to do the mailing script.
and below is an actual quote from the client as to what the problem is in detail..
I am planning on implementing an auto-responder, to help with debugging
I am also planning on including a <noscript> for people who disable javascript (does anyone do that anymore?
)
I really am stuck with this and any help would be GREATLY appriciated. i haven't had much luck on other forums so thought id give this one a blast.
my first post to this forum so be nice to me
my skills in php are fairly limited and ive been working on building a simple form that has form processing using php. It worked fine in testing, the emails came through to me but since i have published this to the web there have been complains from my client that not all the emails are actually coming through.
I did all the obvious checks and tested it myself, yep it still works, checked junk folder, made sure the user actually did click on the submit button, tried in in different web browsers.. so im a bit stumped as to what this problem is...
one reason i thought of was dodgy code, so ive attached below the php code i have written to do the mailing script.
Code: Select all
<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
{
//send email
$surname = $_REQUEST['surname'] ;
$surname_at_school = $_REQUEST['surname_at_school'] ;
$first_name = $_REQUEST['first_name'] ;
$email = $_REQUEST['email'] ;
$home_phone = $_REQUEST['home_phone'] ;
$mobile_phone = $_REQUEST['mobile_phone'] ;
$nametag = $_REQUEST['nametag'] ;
$address = $_REQUEST['address'] ;
$suburb = $_REQUEST['suburb'] ;
$city = $_REQUEST['city'] ;
$postcode = $_REQUEST['postcode'] ;
$country = $_REQUEST['country'] ;
$from = $_REQUEST['from'] ;
$to = $_REQUEST['to'] ;
$association1 = $_REQUEST['association1'] ;
$association2 = $_REQUEST['association2'] ;
$association3 = $_REQUEST['association3'] ;
$association4 = $_REQUEST['association4'] ;
$association5 = $_REQUEST['association5'] ;
$association6 = $_REQUEST['association6'] ;
$association7 = $_REQUEST['association7'] ;
$association8 = $_REQUEST['association8'] ;
$association9 = $_REQUEST['association9'] ;
$nametag2 = $_REQUEST['nametag2'] ;
$permission = $_REQUEST['permission'] ;
$dietary_requirements = $_REQUEST['dietary_requirements'] ;
$additional_comments = $_REQUEST['additional_comments'] ;
$sel0 = $_REQUEST['sel0'] ;
$sel1 = $_REQUEST['sel1'] ;
$sel2 = $_REQUEST['sel2'] ;
$sel3 = $_REQUEST['sel3'] ;
$sel4 = $_REQUEST['sel4'] ;
$sel5 = $_REQUEST['sel5'] ;
$sel6 = $_REQUEST['sel6'] ;
$sel7 = $_REQUEST['sel7'] ;
$sel8 = $_REQUEST['sel8'] ;
$sel9 = $_REQUEST['sel9'] ;
$sel10 = $_REQUEST['sel10'] ;
$sel11 = $_REQUEST['sel11'] ;
$sel12 = $_REQUEST['sel12'] ;
$sel13 = $_REQUEST['sel13'] ;
$paytype = $_REQUEST['paytype'] ;
$paytypeother = $_REQUEST['paytypeother'] ;
$donation = $_REQUEST['donation'] ;
$message .= "\n\n";
$message .= "$surname \n";
$message .= "$surname_at_school \n";
$message .= "$first_name \n";
$message .= "$email \n";
$message .= "$home_phone \n";
$message .= "$mobile_phone \n";
$message .= "$nametag \n";
$message .= "$address \n";
$message .= "$suburb \n";
$message .= "$city \n";
$message .= "$postcode \n";
$message .= "$country \n";
$message .= "$from \n";
$message .= "$to \n";
$message .= "$association1 \n";
$message .= "$association2 \n";
$message .= "$association3 \n";
$message .= "$association4 \n";
$message .= "$association5 \n";
$message .= "$association6 \n";
$message .= "$association7 \n";
$message .= "$association8 \n";
$message .= "$association9 \n";
$message .= "$nametag2 \n";
$message .= "$permission \n";
$message .= "$dietary_requirements \n";
$message .= "$sel0 \n";
$message .= "$sel1 \n";
$message .= "$sel2 \n";
$message .= "$sel3 \n";
$message .= "$sel4 \n";
$message .= "$sel5 \n";
$message .= "$sel6 \n";
$message .= "$sel7 \n";
$message .= "$sel8 \n";
$message .= "$sel9 \n";
$message .= "$sel10 \n";
$message .= "$sel11 \n";
$message .= "$sel12 \n";
$message .= "$sel13 \n";
$message .= "$donation \n";
$message .= "$paytype \n";
$message .= "$paytypeother \n";
$message .= "{$_SERVER['REMOTE_ADDR']} \n";
$message .= "$additional_comments \n";
mail( "nospam@something.co.nz", "Avonhead School - Registration Form",
$message, "From: $email" );
mail( "person2@something.co.nz", "Avonhead School - Registration Form",
$message, "From: $email" );
echo "<p>Thank you for filling out the Registration Form.</p>
";
}
else
//if "email" is not filled out, display the form
{
echo "
<form id='frmOrder' action='index.php' name='eform' onSubmit='return validate(this)'>
<h1>Registration Form</h1>
Please use this form for a <strong>maximum of two people being the Registrant and Partner/ Child/ Clubber</strong><br />
Registrations close on 1 May 2009 – Late registrations accepted until 15 May 2009
<br /><br />
<h2>Personal Information</h2>
<table width='600' border='0' cellpadding='3' cellspacing='1' bgcolor='#CCCCCC'>
<tr>
<td width='266' bgcolor='#FFFFFF'>Surname:</td>
<td width='319' bgcolor='#FFFFFF'><input name='surname' type='text' id='surname' size='40' /></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Surname while at School (if different):</td>
<td bgcolor='#FFFFFF'><input name='surname_at_school' type='text' id='surname_at_school' size='40' /></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>First Name:</td>
<td bgcolor='#FFFFFF'><input name='first_name' type='text' id='first_name' size='40' /></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Email Address:</td>
<td bgcolor='#FFFFFF'><input name='email' type='text' id='email' size='40' /></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Home phone:</td>
<td bgcolor='#FFFFFF'><input name='home_phone' type='text' id='home_phone' size='40' /></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Mobile Phone:</td>
<td bgcolor='#FFFFFF'><input name='mobile_phone' type='text' id='mobile_phone' size='40' /></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Name for Name tag:</td>
<td bgcolor='#FFFFFF'><input name='nametag' type='text' id='nametag' size='40' /></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Address</td>
<td bgcolor='#FFFFFF'><input name='address' type='text' id='address' size='40' /></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Suburb </td>
<td bgcolor='#FFFFFF'><input name='suburb' type='text' id='suburb' size='40' /></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>City </td>
<td bgcolor='#FFFFFF'><input name='city' type='text' id='city' size='40' /></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Post Code </td>
<td bgcolor='#FFFFFF'><input name='postcode' type='text' id='postcode' size='40' /></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Country (if not NZ)</td>
<td bgcolor='#FFFFFF'><input name='country' type='text' id='country' size='40' /></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Years at School: </td>
<td bgcolor='#FFFFFF'>from :
<input name='from' type='text' id='from' size='4' maxlength='4' />
to
<input name='to' type='text' id='to' size='4' maxlength='4' /></td>
</tr>
<tr>
<td valign='top' bgcolor='#FFFFFF'>Association with our school </td>
<td bgcolor='#FFFFFF'><p>
<input type='checkbox' name='association1' value='Principal' />
Principal </p>
<p>
<input type='checkbox' name='association2' value='Teacher' />
Teacher</p>
<p>
<input type='checkbox' name='association3' value='Support Staff' />
Support Staff</p>
<p>
<input type='checkbox' name='association4' value='Pupil' />
Pupil </p>
<p>
<input type='checkbox' name='association5' value='School Committee or Council' />
School Committee/Council</p>
<p>
<input type='checkbox' name='association6' value='Board of Trustees' />
Board of Trustees</p>
<p>
<input type='checkbox' name='association7' value='PTA' />
PTA</p>
<p>
<input type='checkbox' name='association8' value='Parent' />
Parent</p>
<p>
<input type='checkbox' name='association9' value='Other' />
Other</p></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Partner’s Name for Name tag <br />
(if attending):</td>
<td bgcolor='#FFFFFF'><input name='nametag2' type='text' id='nametag2' size='40' /></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Permission to add name(s) and years of attendance to Website/printed Registration list?</td>
<td bgcolor='#FFFFFF'><select name='permission'>
<option value='yes' selected>Yes</option>
<option value='no'>No</option>
</select>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Special dietary requirements?</td>
<td bgcolor='#FFFFFF'><input name='dietary_requirements' type='text' id='dietary_requirements' size='40' /></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Additional Comments </td>
<td bgcolor='#FFFFFF'><textarea name='additional_comments' cols='40' rows='5' id='additional_comments'></textarea></td>
</tr>
</table>
<h2>Event registration</h2>
</p>
<p>
</p>
<table width='600' border='0' cellpadding='3' cellspacing='1' bgcolor='#CCCCCC'>
<tr>
<td width='345' bgcolor='#FFFFFF'><strong>Description</strong></td>
<td width='136' bgcolor='#FFFFFF'><div align='center'><strong>Number Attending </strong></div></td>
<td width='119' bgcolor='#FFFFFF'><div align='center'><strong>Cost
(each)</strong></div></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'><p>Registration Fee :
<br>
Includes registration pack and magazine</p></td>
<td bgcolor='#FFFFFF'>
<div align='center'>
<select id='sel0' name='sel0'>
<option value='0'>0</option>
<option value='1'>1</option>
</select>
</div></td>
<td bgcolor='#FFFFFF'><div align='right'>$<span id='txtPrice0'>60.00</span></div></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Partner/Child/Clubber Registration</td>
<td bgcolor='#FFFFFF'><div align='center'>
<select id='sel1' name='sel1'>
<option value='0'>0</option>
<option value='1'>1</option>
</select>
</div></td>
<td bgcolor='#FFFFFF'><div align='right'>$<span id='txtPrice1'>20.00</span></div></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Friday Open Day from 10am </td>
<td bgcolor='#FFFFFF'><div align='center'>
<select id='sel2' name='sel2'>
<option value='0'>0</option>
<option value='1'>1</option>
<option value='2'>2</option>
</select>
</div></td>
<td bgcolor='#FFFFFF'><div align='right'>$<span id='txtPrice2'>0.00</span></div></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Friday Sausage Sizzle 12.30pm</td>
<td bgcolor='#FFFFFF'><div align='center'>
<select id='sel3' name='sel3'>
<option value='0'>0</option>
<option value='1'>1</option>
<option value='2'>2</option>
</select>
</div></td>
<td bgcolor='#FFFFFF'><div align='right'>$<span id='txtPrice3'>0.00</span></div></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Friday Casual Catch Up (for teenagers) 3.30pm </td>
<td bgcolor='#FFFFFF'><div align='center'>
<select id='sel4' name='sel4'>
<option value='0'>0</option>
<option value='1'>1</option>
<option value='2'>2</option>
</select>
</div></td>
<td bgcolor='#FFFFFF'><div align='right'>$<span id='txtPrice4'>0.00</span></div></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Friday Conversazione 7.30pm</td>
<td bgcolor='#FFFFFF'><div align='center'>
<select id='sel5' name='sel5'>
<option value='0'>0</option>
<option value='1'>1</option>
<option value='2'>2</option>
</select>
</div></td>
<td bgcolor='#FFFFFF'><div align='right'>$<span id='txtPrice5'>30.00</span></div></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Saturday Official Opening 10.30am</td>
<td bgcolor='#FFFFFF'><div align='center'>
<select id='sel6' name='sel6'>
<option value='0'>0</option>
<option value='1'>1</option>
<option value='2'>2</option>
</select>
</div></td>
<td bgcolor='#FFFFFF'><div align='right'>$<span id='txtPrice6'>0.00</span></div></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Saturday Photos from 11.30am (paid for on the day) </td>
<td bgcolor='#FFFFFF'><div align='center'>
<select id='sel7' name='sel7'>
<option value='0'>0</option>
<option value='1'>1</option>
<option value='2'>2</option>
</select>
</div></td>
<td bgcolor='#FFFFFF'><div align='right'>$<span id='txtPrice7'>0.00</span></div></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Saturday Luncheon from 11.30am </td>
<td bgcolor='#FFFFFF'><div align='center'>
<select id='sel8' name='sel8'>
<option value='0'>0</option>
<option value='1'>1</option>
<option value='2'>2</option>
</select>
</div></td>
<td bgcolor='#FFFFFF'><div align='right'>$<span id='txtPrice8'>20.00</span></div></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Saturday Jubilee Dinner from 6.30pm </td>
<td bgcolor='#FFFFFF'><div align='center'>
<select id='sel9' name='sel9'>
<option value='0'>0</option>
<option value='1'>1</option>
<option value='2'>2</option>
</select>
</div></td>
<td bgcolor='#FFFFFF'><div align='right'>$<span id='txtPrice9'>75.00</span></div></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Saturday Clubbing from 9pm
<br />
In lieu of dinner – for 18 yrs +</td>
<td bgcolor='#FFFFFF'><div align='center'>
<select id='sel10' name='sel10'>
<option value='0'>0</option>
<option value='1'>1</option>
<option value='2'>2</option>
</select>
</div></td>
<td bgcolor='#FFFFFF'><div align='right'>$<span id='txtPrice10'>10.00</span></div></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Sunday Thanksgiving Service 11.30am</td>
<td bgcolor='#FFFFFF'><div align='center'>
<select id='sel11' name='sel11'>
<option value='0'>0</option>
<option value='1'>1</option>
<option value='2'>2</option>
</select>
</div></td>
<td bgcolor='#FFFFFF'><div align='right'>$<span id='txtPrice11'>0.00</span></div></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Sunday BBQ Lunch 12.30pm <br />
(teenagers welcome) </td>
<td bgcolor='#FFFFFF'><div align='center'>
<select id='sel12' name='sel12'>
<option value='0'>0</option>
<option value='1'>1</option>
<option value='2'>2</option>
</select>
</div></td>
<td bgcolor='#FFFFFF'><div align='right'>$<span id='txtPrice12'>25.00</span></div></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>Late fee (if received after 1 May)</td>
<td bgcolor='#FFFFFF'><div align='center'>
<select id='sel13' name='sel13'>
<option value='0' selected>0</option>
</select>
</div></td>
<td bgcolor='#FFFFFF'><div align='right'>$20.00</div></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'><strong>Total <br />
</strong></td>
<td bgcolor='#FFFFFF'><div align='center'></div></td>
<td bgcolor='#FFFFFF'><div align='right'>
$<input type='text' disabled id='txtTotal' size='3' style='color:#000000;'/>
</div></td>
</tr>
<tr>
<td bgcolor='#FFFFFF'><strong>Donation</strong> (please enter amount to add to the total) <br /></td>
<td bgcolor='#FFFFFF'><div align='center'></div></td>
<td bgcolor='#FFFFFF'><div align='right'>
$<input type='text' name='donation' size='3' style='color:#000000;' value='0'/>
</div></td>
</tr>
<tr>
<td colspan='3' bgcolor='#FFFFFF'>
<table width='600' border='0' cellspacing='0' cellpadding='10'>
<tr>
<td width='312' valign='top' bgcolor='#FFFFFF'>I will be paying by: <br /></td>
<td width='248' bgcolor='#FFFFFF'><input name='paytype' type='radio' value='Direct Credit online' checked='checked'>Direct Credit online<br>
<input name='paytype' type='radio' value='Cheque'>Cheque<br>
<input name='paytype' type='radio' value='Other'>
Other please specify below <br>
<input type='text' name='paytypeother' size='25' style='color:#000000;'/> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor='#FFFFFF'>
<div align='left'>
<input name='reset' type='reset' value='Clear Form' />
</div></td>
<td bgcolor='#FFFFFF'><div align='center'></div></td>
<td bgcolor='#FFFFFF'><div align='center'><input name='submit' type='submit' class='submit' id='submit' value='Submit Registration' /></div></td>
</tr>
</table>
</form>.";
}
?>and below is an actual quote from the client as to what the problem is in detail..
The problem is not all registrations are coming through to me via the email link.
The person on the committee who has had this problem that I have been able to speak to has hit the submit button and has seen the next screen that appears with the account details etc. I wondered too if it was a problem if they closed the web browser at that point rather than just closing the screen that’s why I asked you that question of when does the email notification to me get sent.
She has submitted it three times over several days. She is using Internet explorer 7.0 the same version as myself.
I am planning on implementing an auto-responder, to help with debugging
I am also planning on including a <noscript> for people who disable javascript (does anyone do that anymore?
I really am stuck with this and any help would be GREATLY appriciated. i haven't had much luck on other forums so thought id give this one a blast.