For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > November 2006 > php form help









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author php form help
liamo

2006-11-28, 7:00 pm

Don't laugh lol I know your all php guru's : )

Ok, so I have little if any knowledge with the programming language php
- only having created small enquiry forms. Now I have a client that
needs a job order form with a little more function than having solely
contact details and a big enquiry text area.

The form I created in HTML is located at
http://www.ebesign.co.nz/projects/j...order_form.html
and has used javascript to validate the fields against spammers etc but
now I am looking to process it all in a php form using the mail
function.

Basically I want my form to gather all the information including check
boxes, drop down menu's and to email it to my client - simple enough
request but I don't know the code and cannot find a worth while
tutorial or php resource ( most out there are simple forms without
drops downs, etc )

Any help, suggestions, or recommendations?

Much Appreciated netizens.
Liam

Tyrone Slothrop

2006-11-28, 7:00 pm

On 28 Nov 2006 06:09:43 -0800, "liamo" <liam.lorigan@gmail.com> wrote:

>Don't laugh lol I know your all php guru's : )
>
>Ok, so I have little if any knowledge with the programming language php
>- only having created small enquiry forms. Now I have a client that
>needs a job order form with a little more function than having solely
>contact details and a big enquiry text area.
>
>The form I created in HTML is located at
>http://www.ebesign.co.nz/projects/j...order_form.html
>and has used javascript to validate the fields against spammers etc but
>now I am looking to process it all in a php form using the mail
>function.
>
>Basically I want my form to gather all the information including check
>boxes, drop down menu's and to email it to my client - simple enough
>request but I don't know the code and cannot find a worth while
>tutorial or php resource ( most out there are simple forms without
>drops downs, etc )
>
>Any help, suggestions, or recommendations?
>
>Much Appreciated netizens.
>Liam


OK, I am not laughing but am somewhat amused, mostly because you have
a lot of learning ahead of you. ;-) I would imagine that there is a
time for learning and a time to finish a project and move on to the
next, so I offer a quick solution.

Primarily what you need to do is take all of those form vars and plug
them into the body of an email. Posting a form creates an array of
keys and values. Let's just return those to the email:

foreach ($_POST as $key=>$value) {
$bodyArr[] = "$key : $value";
}

$body = implode ("\n", $bodyArr);

mail ($to, $subject, $body, $headers);

So what I have done here is take every POST var, created an array of
values and keys, then added them to the body of the email with a
newline between each.

Of course, some of those vars you may not want to pass to the email,
so you can filter those out and capitalizing the keys would be nice:

$noSendArr = array ('submit');

foreach ($_POST as $key=>$value) {
if (!in_array ($key, $noSendArr) {
$bodyArr[] = ucwords($key)." : $value";
}
}

That should get you started. Good luck!
Geoff Berrow

2006-11-28, 7:00 pm

Message-ID: <1164722983.022356.161810@j72g2000cwa.googlegroups.com> from
liamo contained the following:

>Basically I want my form to gather all the information including check
>boxes, drop down menu's and to email it to my client - simple enough
>request but I don't know the code and cannot find a worth while
>tutorial or php resource ( most out there are simple forms without
>drops downs, etc )
>
>Any help, suggestions, or recommendations?


You could use:
http://www.ckdog.co.uk/phmail

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Krustov

2006-11-28, 7:00 pm

<comp.lang.php>
<liamo>
<28 Nov 2006 06:09:43 -0800>
<1164722983.022356.161810@j72g2000cwa.googlegroups.com>

> The form I created in HTML is located at
> http://www.ebesign.co.nz/projects/j...order_form.html
> and has used javascript to validate the fields against spammers etc but
> now I am looking to process it all in a php form using the mail
> function.


Very easy to do once you understand how forms work with php .

> Basically I want my form to gather all the information including check
> boxes, drop down menu's and to email it to my client - simple enough
> request but I don't know the code and cannot find a worth while
> tutorial or php resource ( most out there are simple forms without
> drops downs, etc )
>



<html>
<head>

<title>form.php</title>

</head>

<body>

<table border="0" cellspacing="0" cellpadding="0" align="center">

<form action="form_submit.php" method="post">

<tr valign="top">
<td>Your Name:</td>
<td>   </td>
<td><input type="text" name="phil_one" size="65"></td>
</tr>

<tr valign="top">
<td>Comments:</td>
<td></td>
<td><textarea cols="65" rows="11" name="phil_two"></textarea></td>
</tr>

<tr valign="top">
<td></td>
<td></td>
<td><input type="submit" name="Submit" value="SUBMIT"></td>
</tr>

</form>

</table>

</body>
</html>





<html>
<head>

<title>form_submit.php</title>

</head>

<body>

<?php
$demo1=$_POST['phil_one'];
$demo2=$_POST['phil_two'];
?>

<table border="0" cellspacing="0" cellpadding="0" align="center">

<tr valign="top">
<td>The name you entered was:</td>
<td>   </td>
<td><?php print $demo1; ?></td>
</tr>

<tr>
<td>The comments you entered are:</td>
<td></td>
<td><?php print $demo2; ?></td>
</tr>

</table>

<?php

$ewho="webmaster@yourdomain.com";

$datesent=date("l dS of F Y h:i A");

$ip=$_SERVER['REMOTE_ADDR'];

$subject="FROM THE WEBSITE FORM";

$mailhead="From: $ewho \n";

$mailbody ="This email was sent via the website form" . "\n\n";
$mailbody .="NAME: " . "$demo1" . "\n\n";
$mailbody .="COMMENTS: " . "$demo2" . "\n\n";
$mailbody .="DATE: " . "$datesent" . "\n\n";
$mailbody .="IP: " . "$ip" . "\n\n";

$body .=stripslashes($mailbody);

mail($ewho,$subject,$body,$mailhead);

?>

</body>
</html>


Basically all you have to do is learn a bit more about forms and add
your new knowledge to the above .

Drop down box selections and tick boxes are passed in the same way to
the next page - so its really just a matter of giving them a name that
doesnt clash with "phil_one" or "phil_two" .

"phil_three"
"phil_four"

etc would work fine .


--
www.phpwhois.co.uk
Krustov

2006-11-28, 7:00 pm

<comp.lang.php>
<liamo>
<28 Nov 2006 06:09:43 -0800>
<1164722983.022356.161810@j72g2000cwa.googlegroups.com>

> Ok, so I have little if any knowledge with the programming language php
> - only having created small enquiry forms. Now I have a client that
> needs a job order form with a little more function than having solely
> contact details and a big enquiry text area.
>
> The form I created in HTML is located at
> http://www.ebesign.co.nz/projects/j...order_form.html
>


Ahhh what the hell i wrote the form for you as there isnt a lot on tv
tonight and because writing the full thing really annoys some people on
this newsgroup - so its your lucky day dude .

$ewho="webmaster@yourdomain.com";

The email address on the 2nd page is the only thing you need to edit in
order to test the form / script .





<html>
<head>

<title>aform.php</title>

</head>

<body>

<table border="0" cellspacing="0" cellpadding="0" align="center">

<form action="aform_submit.php" method="post">

<tr valign="top">
<td>Your Full Name :</td>
</tr>

<tr valign="top">
<td><input type="text" name="krusty_01" size="65"></td>
</tr>

<tr><td><br></td></tr>

<tr valign="top">
<td>Your Email Address :</td>
</tr>

<tr valign="top">
<td><input type="text" name="krusty_02" size="65"></td>
</tr>

<tr><td><br></td></tr>

<tr valign="top">
<td>Your Contact Number :</td>
</tr>

<tr valign="top">
<td><input type="text" name="krusty_03" size="65"></td>
</tr>

<tr><td><br></td></tr>

<tr valign="top">
<td>Your Full Address : (job location)</td>
</tr>

<tr valign="top">
<td><textarea cols="50" rows="5" name="krusty_04"></textarea></td>
</tr>

<tr><td><br></td></tr>

<tr valign="top">
<td>Job Type :</td>
</tr>

<tr valign="top">
<td>
<input type="checkbox" name="krusty_05" value="checked"> Interior  
<input type="checkbox" name="krusty_06" value="checked"> Exterior  
<input type="checkbox" name="krusty_07" value="checked"> Both  
<input type="checkbox" name="krusty_08" value="checked"> Dont Know
</td>
</tr>

<tr><td><br></td></tr>

<tr valign="top">
<td>Interior Job :</td>
</tr>

<tr valign="top">
<td>
<select name="krusty_09">
<option value="Please Select ....." selected>Please Select .....
</option>
<option value="Leaking taps">Leaking taps</option>
<option value="Broken window catches">Broken window catches</option>
<option value="Jamming doors">Jamming doors</option>
<option value="Security stays">Security stays</option>
<option value="Door handles">Door handles</option>
<option value="Install door stops">Install door stops</option>
<option value="Interior house painting">Interior house painting</option>
<option value="Gib board repairs">Gib board repairs</option>
<option value="Gib board repairs">Gib board repairs</option>
<option value="Install curtain rails">Install curtain rails</option>
<option value="Tiling">Tiling</option>
<option value="Ranch slider bearings">Ranch slider bearings</option>
<option value="Replace hinges doors/cabinets">Replace hinges
doors/cabinets</option>
<option value="Wardrobe rails">Wardrobe rails</option>
<option value="Heated towel rail bracket replacement">Heated towel rail
bracket replacement</option>
<option value="Hand rail, toilet roll holder installation">Hand rail,
toilet roll holder installation</option>
<option value="Internal door installation">Internal door installation
</option>
<option value="Replace bathroom vanity">Replace bathroom vanity</option>
<option value="Remove broken light bulbs from sockets">Remove broken
light bulbs from sockets</option>
<option value="Shower door seals">Shower door seals</option>
<option value="Shower head replacement">Shower head replacement</option>
<option value="Dont Know">Dont Know</option>
<option value="None">None</option>
<option value="Other">Other</option>
</select>
</td>
</tr>

<tr><td><br></td></tr>

<tr valign="top">
<td>Exterior Job :</td>
</tr>

<tr valign="top">
<td>
<select name="krusty_10">
<option value="Please Select ....." selected>Please Select .....
</option>
<option value="Fencing">Fencing</option>
<option value="Retaining">Retaining</option>
<option value="Gardening">Gardening</option>
<option value="Clean out gutters & repairs">Clean out gutters & repairs
</option>
<option value="Exterior house painting">Exterior house painting</option>
<option value="Letterbox replacement">Letterbox replacement</option>
<option value="Replace washing lines">Replace washing lines</option>
<option value="Waterblasting path/decks">Waterblasting path/decks
</option>
<option value="Repair decking & steps">Repair decking & steps</option>
<option value="Lawn mowing">Lawn mowing</option>
<option value="Rubbish removal">Rubbish removal</option>
<option value="Weather board repairs">Weather board repairs</option>
<option value="Weed Spraying">Weed Spraying</option>
<option value="Dont Know">Dont Know</option>
<option value="None">None</option>
<option value="Other">Other</option>
</select>
</td>
</tr>

<tr><td><br></td></tr>

<tr valign="top">
<td>Job Description :</td>
</tr>

<tr valign="top">
<td><textarea cols="50" rows="9" name="krusty_11"></textarea></td>
</tr>

<tr><td><br></td></tr>

<tr valign="top">
<td><input type="submit" name="Submit" value="SUBMIT"></td>
</tr>

</form>

</table>

</body>
</html>








<html>
<head>

<title>aform_submit.php</title>

</head>

<body>

<?php
$homer01=$_POST['krusty_01'];
$homer02=$_POST['krusty_02'];
$homer03=$_POST['krusty_03'];
$homer04=$_POST['krusty_04'];
$homer05=$_POST['krusty_05'];
$homer06=$_POST['krusty_06'];
$homer07=$_POST['krusty_07'];
$homer08=$_POST['krusty_08'];
$homer09=$_POST['krusty_09'];
$homer10=$_POST['krusty_10'];
$homer11=$_POST['krusty_11'];
?>

<?php

$marge5="Not Selected";
if ($homer05=="checked") {$marge5="TICKED AND SELECTED";}

$marge6="Not Selected";
if ($homer06=="checked") {$marge6="TICKED AND SELECTED";}

$marge7="Not Selected";
if ($homer07=="checked") {$marge7="TICKED AND SELECTED";}

$marge8="Not Selected";
if ($homer08=="checked") {$marge8="TICKED AND SELECTED";}

?>

<table border="0" cellspacing="0" cellpadding="0" align="center">

<tr valign="top">
<td>Your Full Name :</td>
</tr>

<tr valign="top">
<td><?php print $homer01; ?></td>
</tr>

<tr><td><br></td></tr>

<tr valign="top">
<td>Your Email Address :</td>
</tr>

<tr valign="top">
<td><?php print $homer02; ?></td>
</tr>

<tr><td><br></td></tr>

<tr valign="top">
<td>Your Contact Number :</td>
</tr>

<tr valign="top">
<td><?php print $homer03; ?></td>
</tr>

<tr><td><br></td></tr>

<tr valign="top">
<td>Your Full Address : (job location)</td>
</tr>

<tr valign="top">
<td><?php print $homer04; ?></td>
</tr>

<tr><td><br></td></tr>

<tr valign="top">
<td>Interior</td>
</tr>

<tr valign="top">
<td><?php print $marge5; ?></td>
</tr>

<tr><td><br></td></tr>

<tr valign="top">
<td>Exterior</td>
</tr>

<tr valign="top">
<td><?php print $marge6; ?></td>
</tr>

<tr><td><br></td></tr>

<tr valign="top">
<td>Both</td>
</tr>

<tr valign="top">
<td><?php print $marge7; ?></td>
</tr>

<tr><td><br></td></tr>

<tr valign="top">
<td>Dont Know</td>
</tr>

<tr valign="top">
<td><?php print $marge8; ?></td>
</tr>

<tr><td><br></td></tr>

<tr valign="top">
<td>Interior Job :</td>
</tr>

<tr valign="top">
<td><?php print $homer09; ?></td>
</tr>

<tr><td><br></td></tr>

<tr valign="top">
<td>Exterior Job :</td>
</tr>

<tr valign="top">
<td><?php print $homer10; ?></td>
</tr>

<tr><td><br></td></tr>

<tr valign="top">
<td>Job Description :</td>
</tr>

<tr valign="top">
<td><?php print $homer11; ?></td>
</tr>

</table>

<?php

$ewho="webmaster@yourdomain.com";

$datesent=date("l dS of F Y h:i A");

$ip=$_SERVER['REMOTE_ADDR'];

$subject="FROM THE WEBSITE FORM";

$mailhead="From: $ewho \n";

$mailbody ="This email was sent via the website form" . "\n\n";
$mailbody .="DATE: " . "$datesent" . "\n\n";
$mailbody .="IP: " . "$ip" . "\n\n";
$mailbody .="Full Name: " . "$krusty_01" . "\n\n";
$mailbody .="Email Address: " . "$krusty_02" . "\n\n";
$mailbody .="Contact Number: " . "$krusty_03" . "\n\n";
$mailbody .="Full Address (job location) : " . "$krusty_04" . "\n\n";
$mailbody .="Interior {box): " . "$marge5" . "\n\n";
$mailbody .="Exterior {box): " . "$marge6" . "\n\n";
$mailbody .="Both {box): " . "$marge7" . "\n\n";
$mailbody .="Dont Know {box): " . "$marge8" . "\n\n";
$mailbody .="Interior Job: " . "$krusty_09" . "\n\n";
$mailbody .="Exterior Job: " . "$krusty_10" . "\n\n";
$mailbody .="Job Description: " . "$krusty_11" . "\n\n";

$body .=stripslashes($mailbody);

mail($ewho,$subject,$body,$mailhead);

?>

</body>
</html>





liamo

2006-11-28, 7:00 pm

thank you all so much and krustov the whole form! wow thanks.

Now that gives me something to work on, i will probably look into forms
and try improve.

Krustov wrote:
> <comp.lang.php>
> <liamo>
> <28 Nov 2006 06:09:43 -0800>
> <1164722983.022356.161810@j72g2000cwa.googlegroups.com>
>
>
> Ahhh what the hell i wrote the form for you as there isnt a lot on tv
> tonight and because writing the full thing really annoys some people on
> this newsgroup - so its your lucky day dude .
>
> $ewho="webmaster@yourdomain.com";
>
> The email address on the 2nd page is the only thing you need to edit in
> order to test the form / script .
>
>
>
>
>
> <html>
> <head>
>
> <title>aform.php</title>
>
> </head>
>
> <body>
>
> <table border="0" cellspacing="0" cellpadding="0" align="center">
>
> <form action="aform_submit.php" method="post">
>
> <tr valign="top">
> <td>Your Full Name :</td>
> </tr>
>
> <tr valign="top">
> <td><input type="text" name="krusty_01" size="65"></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Your Email Address :</td>
> </tr>
>
> <tr valign="top">
> <td><input type="text" name="krusty_02" size="65"></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Your Contact Number :</td>
> </tr>
>
> <tr valign="top">
> <td><input type="text" name="krusty_03" size="65"></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Your Full Address : (job location)</td>
> </tr>
>
> <tr valign="top">
> <td><textarea cols="50" rows="5" name="krusty_04"></textarea></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Job Type :</td>
> </tr>
>
> <tr valign="top">
> <td>
> <input type="checkbox" name="krusty_05" value="checked"> Interior  
> <input type="checkbox" name="krusty_06" value="checked"> Exterior  
> <input type="checkbox" name="krusty_07" value="checked"> Both  
> <input type="checkbox" name="krusty_08" value="checked"> Dont Know
> </td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Interior Job :</td>
> </tr>
>
> <tr valign="top">
> <td>
> <select name="krusty_09">
> <option value="Please Select ....." selected>Please Select .....
> </option>
> <option value="Leaking taps">Leaking taps</option>
> <option value="Broken window catches">Broken window catches</option>
> <option value="Jamming doors">Jamming doors</option>
> <option value="Security stays">Security stays</option>
> <option value="Door handles">Door handles</option>
> <option value="Install door stops">Install door stops</option>
> <option value="Interior house painting">Interior house painting</option>
> <option value="Gib board repairs">Gib board repairs</option>
> <option value="Gib board repairs">Gib board repairs</option>
> <option value="Install curtain rails">Install curtain rails</option>
> <option value="Tiling">Tiling</option>
> <option value="Ranch slider bearings">Ranch slider bearings</option>
> <option value="Replace hinges doors/cabinets">Replace hinges
> doors/cabinets</option>
> <option value="Wardrobe rails">Wardrobe rails</option>
> <option value="Heated towel rail bracket replacement">Heated towel rail
> bracket replacement</option>
> <option value="Hand rail, toilet roll holder installation">Hand rail,
> toilet roll holder installation</option>
> <option value="Internal door installation">Internal door installation
> </option>
> <option value="Replace bathroom vanity">Replace bathroom vanity</option>
> <option value="Remove broken light bulbs from sockets">Remove broken
> light bulbs from sockets</option>
> <option value="Shower door seals">Shower door seals</option>
> <option value="Shower head replacement">Shower head replacement</option>
> <option value="Dont Know">Dont Know</option>
> <option value="None">None</option>
> <option value="Other">Other</option>
> </select>
> </td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Exterior Job :</td>
> </tr>
>
> <tr valign="top">
> <td>
> <select name="krusty_10">
> <option value="Please Select ....." selected>Please Select .....
> </option>
> <option value="Fencing">Fencing</option>
> <option value="Retaining">Retaining</option>
> <option value="Gardening">Gardening</option>
> <option value="Clean out gutters & repairs">Clean out gutters & repairs
> </option>
> <option value="Exterior house painting">Exterior house painting</option>
> <option value="Letterbox replacement">Letterbox replacement</option>
> <option value="Replace washing lines">Replace washing lines</option>
> <option value="Waterblasting path/decks">Waterblasting path/decks
> </option>
> <option value="Repair decking & steps">Repair decking & steps</option>
> <option value="Lawn mowing">Lawn mowing</option>
> <option value="Rubbish removal">Rubbish removal</option>
> <option value="Weather board repairs">Weather board repairs</option>
> <option value="Weed Spraying">Weed Spraying</option>
> <option value="Dont Know">Dont Know</option>
> <option value="None">None</option>
> <option value="Other">Other</option>
> </select>
> </td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Job Description :</td>
> </tr>
>
> <tr valign="top">
> <td><textarea cols="50" rows="9" name="krusty_11"></textarea></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td><input type="submit" name="Submit" value="SUBMIT"></td>
> </tr>
>
> </form>
>
> </table>
>
> </body>
> </html>
>
>
>
>
>
>
>
>
> <html>
> <head>
>
> <title>aform_submit.php</title>
>
> </head>
>
> <body>
>
> <?php
> $homer01=$_POST['krusty_01'];
> $homer02=$_POST['krusty_02'];
> $homer03=$_POST['krusty_03'];
> $homer04=$_POST['krusty_04'];
> $homer05=$_POST['krusty_05'];
> $homer06=$_POST['krusty_06'];
> $homer07=$_POST['krusty_07'];
> $homer08=$_POST['krusty_08'];
> $homer09=$_POST['krusty_09'];
> $homer10=$_POST['krusty_10'];
> $homer11=$_POST['krusty_11'];
> ?>
>
> <?php
>
> $marge5="Not Selected";
> if ($homer05=="checked") {$marge5="TICKED AND SELECTED";}
>
> $marge6="Not Selected";
> if ($homer06=="checked") {$marge6="TICKED AND SELECTED";}
>
> $marge7="Not Selected";
> if ($homer07=="checked") {$marge7="TICKED AND SELECTED";}
>
> $marge8="Not Selected";
> if ($homer08=="checked") {$marge8="TICKED AND SELECTED";}
>
> ?>
>
> <table border="0" cellspacing="0" cellpadding="0" align="center">
>
> <tr valign="top">
> <td>Your Full Name :</td>
> </tr>
>
> <tr valign="top">
> <td><?php print $homer01; ?></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Your Email Address :</td>
> </tr>
>
> <tr valign="top">
> <td><?php print $homer02; ?></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Your Contact Number :</td>
> </tr>
>
> <tr valign="top">
> <td><?php print $homer03; ?></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Your Full Address : (job location)</td>
> </tr>
>
> <tr valign="top">
> <td><?php print $homer04; ?></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Interior</td>
> </tr>
>
> <tr valign="top">
> <td><?php print $marge5; ?></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Exterior</td>
> </tr>
>
> <tr valign="top">
> <td><?php print $marge6; ?></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Both</td>
> </tr>
>
> <tr valign="top">
> <td><?php print $marge7; ?></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Dont Know</td>
> </tr>
>
> <tr valign="top">
> <td><?php print $marge8; ?></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Interior Job :</td>
> </tr>
>
> <tr valign="top">
> <td><?php print $homer09; ?></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Exterior Job :</td>
> </tr>
>
> <tr valign="top">
> <td><?php print $homer10; ?></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Job Description :</td>
> </tr>
>
> <tr valign="top">
> <td><?php print $homer11; ?></td>
> </tr>
>
> </table>
>
> <?php
>
> $ewho="webmaster@yourdomain.com";
>
> $datesent=date("l dS of F Y h:i A");
>
> $ip=$_SERVER['REMOTE_ADDR'];
>
> $subject="FROM THE WEBSITE FORM";
>
> $mailhead="From: $ewho \n";
>
> $mailbody ="This email was sent via the website form" . "\n\n";
> $mailbody .="DATE: " . "$datesent" . "\n\n";
> $mailbody .="IP: " . "$ip" . "\n\n";
> $mailbody .="Full Name: " . "$krusty_01" . "\n\n";
> $mailbody .="Email Address: " . "$krusty_02" . "\n\n";
> $mailbody .="Contact Number: " . "$krusty_03" . "\n\n";
> $mailbody .="Full Address (job location) : " . "$krusty_04" . "\n\n";
> $mailbody .="Interior {box): " . "$marge5" . "\n\n";
> $mailbody .="Exterior {box): " . "$marge6" . "\n\n";
> $mailbody .="Both {box): " . "$marge7" . "\n\n";
> $mailbody .="Dont Know {box): " . "$marge8" . "\n\n";
> $mailbody .="Interior Job: " . "$krusty_09" . "\n\n";
> $mailbody .="Exterior Job: " . "$krusty_10" . "\n\n";
> $mailbody .="Job Description: " . "$krusty_11" . "\n\n";
>
> $body .=stripslashes($mailbody);
>
> mail($ewho,$subject,$body,$mailhead);
>
> ?>
>
> </body>
> </html>


liamo

2006-11-28, 7:00 pm

um small problem.

the form emails fine but results in no values like it does not state
the name and rest in the email..

"This email was sent via the website form

DATE: Wednesday 29th of November 2006 01:22 PM

IP: 202.74.217.170

Full Name:

Email Address:

Contact Number:

Full Address (job location) :

Interior {box):

Exterior {box):

Both {box):

Dont Know {box):

Interior Job:

Exterior Job:

Job Description:


Krustov wrote:
> <comp.lang.php>
> <liamo>
> <28 Nov 2006 06:09:43 -0800>
> <1164722983.022356.161810@j72g2000cwa.googlegroups.com>
>
>
> Ahhh what the hell i wrote the form for you as there isnt a lot on tv
> tonight and because writing the full thing really annoys some people on
> this newsgroup - so its your lucky day dude .
>
> $ewho="webmaster@yourdomain.com";
>
> The email address on the 2nd page is the only thing you need to edit in
> order to test the form / script .
>
>
>
>
>
> <html>
> <head>
>
> <title>aform.php</title>
>
> </head>
>
> <body>
>
> <table border="0" cellspacing="0" cellpadding="0" align="center">
>
> <form action="aform_submit.php" method="post">
>
> <tr valign="top">
> <td>Your Full Name :</td>
> </tr>
>
> <tr valign="top">
> <td><input type="text" name="krusty_01" size="65"></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Your Email Address :</td>
> </tr>
>
> <tr valign="top">
> <td><input type="text" name="krusty_02" size="65"></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Your Contact Number :</td>
> </tr>
>
> <tr valign="top">
> <td><input type="text" name="krusty_03" size="65"></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Your Full Address : (job location)</td>
> </tr>
>
> <tr valign="top">
> <td><textarea cols="50" rows="5" name="krusty_04"></textarea></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Job Type :</td>
> </tr>
>
> <tr valign="top">
> <td>
> <input type="checkbox" name="krusty_05" value="checked"> Interior  
> <input type="checkbox" name="krusty_06" value="checked"> Exterior  
> <input type="checkbox" name="krusty_07" value="checked"> Both  
> <input type="checkbox" name="krusty_08" value="checked"> Dont Know
> </td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Interior Job :</td>
> </tr>
>
> <tr valign="top">
> <td>
> <select name="krusty_09">
> <option value="Please Select ....." selected>Please Select .....
> </option>
> <option value="Leaking taps">Leaking taps</option>
> <option value="Broken window catches">Broken window catches</option>
> <option value="Jamming doors">Jamming doors</option>
> <option value="Security stays">Security stays</option>
> <option value="Door handles">Door handles</option>
> <option value="Install door stops">Install door stops</option>
> <option value="Interior house painting">Interior house painting</option>
> <option value="Gib board repairs">Gib board repairs</option>
> <option value="Gib board repairs">Gib board repairs</option>
> <option value="Install curtain rails">Install curtain rails</option>
> <option value="Tiling">Tiling</option>
> <option value="Ranch slider bearings">Ranch slider bearings</option>
> <option value="Replace hinges doors/cabinets">Replace hinges
> doors/cabinets</option>
> <option value="Wardrobe rails">Wardrobe rails</option>
> <option value="Heated towel rail bracket replacement">Heated towel rail
> bracket replacement</option>
> <option value="Hand rail, toilet roll holder installation">Hand rail,
> toilet roll holder installation</option>
> <option value="Internal door installation">Internal door installation
> </option>
> <option value="Replace bathroom vanity">Replace bathroom vanity</option>
> <option value="Remove broken light bulbs from sockets">Remove broken
> light bulbs from sockets</option>
> <option value="Shower door seals">Shower door seals</option>
> <option value="Shower head replacement">Shower head replacement</option>
> <option value="Dont Know">Dont Know</option>
> <option value="None">None</option>
> <option value="Other">Other</option>
> </select>
> </td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Exterior Job :</td>
> </tr>
>
> <tr valign="top">
> <td>
> <select name="krusty_10">
> <option value="Please Select ....." selected>Please Select .....
> </option>
> <option value="Fencing">Fencing</option>
> <option value="Retaining">Retaining</option>
> <option value="Gardening">Gardening</option>
> <option value="Clean out gutters & repairs">Clean out gutters & repairs
> </option>
> <option value="Exterior house painting">Exterior house painting</option>
> <option value="Letterbox replacement">Letterbox replacement</option>
> <option value="Replace washing lines">Replace washing lines</option>
> <option value="Waterblasting path/decks">Waterblasting path/decks
> </option>
> <option value="Repair decking & steps">Repair decking & steps</option>
> <option value="Lawn mowing">Lawn mowing</option>
> <option value="Rubbish removal">Rubbish removal</option>
> <option value="Weather board repairs">Weather board repairs</option>
> <option value="Weed Spraying">Weed Spraying</option>
> <option value="Dont Know">Dont Know</option>
> <option value="None">None</option>
> <option value="Other">Other</option>
> </select>
> </td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Job Description :</td>
> </tr>
>
> <tr valign="top">
> <td><textarea cols="50" rows="9" name="krusty_11"></textarea></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td><input type="submit" name="Submit" value="SUBMIT"></td>
> </tr>
>
> </form>
>
> </table>
>
> </body>
> </html>
>
>
>
>
>
>
>
>
> <html>
> <head>
>
> <title>aform_submit.php</title>
>
> </head>
>
> <body>
>
> <?php
> $homer01=$_POST['krusty_01'];
> $homer02=$_POST['krusty_02'];
> $homer03=$_POST['krusty_03'];
> $homer04=$_POST['krusty_04'];
> $homer05=$_POST['krusty_05'];
> $homer06=$_POST['krusty_06'];
> $homer07=$_POST['krusty_07'];
> $homer08=$_POST['krusty_08'];
> $homer09=$_POST['krusty_09'];
> $homer10=$_POST['krusty_10'];
> $homer11=$_POST['krusty_11'];
> ?>
>
> <?php
>
> $marge5="Not Selected";
> if ($homer05=="checked") {$marge5="TICKED AND SELECTED";}
>
> $marge6="Not Selected";
> if ($homer06=="checked") {$marge6="TICKED AND SELECTED";}
>
> $marge7="Not Selected";
> if ($homer07=="checked") {$marge7="TICKED AND SELECTED";}
>
> $marge8="Not Selected";
> if ($homer08=="checked") {$marge8="TICKED AND SELECTED";}
>
> ?>
>
> <table border="0" cellspacing="0" cellpadding="0" align="center">
>
> <tr valign="top">
> <td>Your Full Name :</td>
> </tr>
>
> <tr valign="top">
> <td><?php print $homer01; ?></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Your Email Address :</td>
> </tr>
>
> <tr valign="top">
> <td><?php print $homer02; ?></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Your Contact Number :</td>
> </tr>
>
> <tr valign="top">
> <td><?php print $homer03; ?></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Your Full Address : (job location)</td>
> </tr>
>
> <tr valign="top">
> <td><?php print $homer04; ?></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Interior</td>
> </tr>
>
> <tr valign="top">
> <td><?php print $marge5; ?></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Exterior</td>
> </tr>
>
> <tr valign="top">
> <td><?php print $marge6; ?></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Both</td>
> </tr>
>
> <tr valign="top">
> <td><?php print $marge7; ?></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Dont Know</td>
> </tr>
>
> <tr valign="top">
> <td><?php print $marge8; ?></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Interior Job :</td>
> </tr>
>
> <tr valign="top">
> <td><?php print $homer09; ?></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Exterior Job :</td>
> </tr>
>
> <tr valign="top">
> <td><?php print $homer10; ?></td>
> </tr>
>
> <tr><td><br></td></tr>
>
> <tr valign="top">
> <td>Job Description :</td>
> </tr>
>
> <tr valign="top">
> <td><?php print $homer11; ?></td>
> </tr>
>
> </table>
>
> <?php
>
> $ewho="webmaster@yourdomain.com";
>
> $datesent=date("l dS of F Y h:i A");
>
> $ip=$_SERVER['REMOTE_ADDR'];
>
> $subject="FROM THE WEBSITE FORM";
>
> $mailhead="From: $ewho \n";
>
> $mailbody ="This email was sent via the website form" . "\n\n";
> $mailbody .="DATE: " . "$datesent" . "\n\n";
> $mailbody .="IP: " . "$ip" . "\n\n";
> $mailbody .="Full Name: " . "$krusty_01" . "\n\n";
> $mailbody .="Email Address: " . "$krusty_02" . "\n\n";
> $mailbody .="Contact Number: " . "$krusty_03" . "\n\n";
> $mailbody .="Full Address (job location) : " . "$krusty_04" . "\n\n";
> $mailbody .="Interior {box): " . "$marge5" . "\n\n";
> $mailbody .="Exterior {box): " . "$marge6" . "\n\n";
> $mailbody .="Both {box): " . "$marge7" . "\n\n";
> $mailbody .="Dont Know {box): " . "$marge8" . "\n\n";
> $mailbody .="Interior Job: " . "$krusty_09" . "\n\n";
> $mailbody .="Exterior Job: " . "$krusty_10" . "\n\n";
> $mailbody .="Job Description: " . "$krusty_11" . "\n\n";
>
> $body .=stripslashes($mailbody);
>
> mail($ewho,$subject,$body,$mailhead);
>
> ?>
>
> </body>
> </html>


liamo

2006-11-28, 7:00 pm

the form http://www.ebesign.co.nz/projects/j..._order_form.php
the thank you confirmation page
http://www.ebesign.co.nz/projects/j...form_submit.php
the email it sends me
http://www.ebesign.co.nz/projects/justfixit/email.jpg


liamo wrote:[color=darkred]
> um small problem.
>
> the form emails fine but results in no values like it does not state
> the name and rest in the email..
>
> "This email was sent via the website form
>
> DATE: Wednesday 29th of November 2006 01:22 PM
>
> IP: 202.74.217.170
>
> Full Name:
>
> Email Address:
>
> Contact Number:
>
> Full Address (job location) :
>
> Interior {box):
>
> Exterior {box):
>
> Both {box):
>
> Dont Know {box):
>
> Interior Job:
>
> Exterior Job:
>
> Job Description:
>
>
> Krustov wrote:

Geoff Berrow

2006-11-28, 9:57 pm

Message-ID: <1164759925.329422.137590@80g2000cwy.googlegroups.com> from
liamo contained the following:

>um small problem.
>
>the form emails fine but results in no values like it does not state
>the name and rest in the email..


My guess is that krusty has register globals on (which is why he didn't
spot his mistake) and you don't.
[color=darkred]

This, and the others should be the $homer variables.

My script is better. :-P





--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Krustov

2006-11-28, 9:57 pm

<comp.lang.php>
<Geoff Berrow>
<Wed, 29 Nov 2006 01:09:02 +0000>
<t1npm29rrccs5m5oegrt0h49ft1htbuhee@4ax.com>

>
> This, and the others should be the $homer variables.
>


Opps - guess i really should check stuff first :-)

$homer_** should be used instead of $krusty_**

$mailbody ="This email was sent via the website form" . "\n\n";
$mailbody .="DATE: " . "$datesent" . "\n\n";
$mailbody .="IP: " . "$ip" . "\n\n";
$mailbody .="Full Name: " . "$homer_01" . "\n\n";
$mailbody .="Email Address: " . "$homer_02" . "\n\n";
$mailbody .="Contact Number: " . "$homer_03" . "\n\n";
$mailbody .="Full Address (job location) : " . "$homer_04" . "\n\n";
$mailbody .="Interior {box): " . "$marge5" . "\n\n";
$mailbody .="Exterior {box): " . "$marge6" . "\n\n";
$mailbody .="Both {box): " . "$marge7" . "\n\n";
$mailbody .="Dont Know {box): " . "$marge8" . "\n\n";
$mailbody .="Interior Job: " . "$homer_09" . "\n\n";
$mailbody .="Exterior Job: " . "$homer_10" . "\n\n";
$mailbody .="Job Description: " . "$homer_11" . "\n\n";

Although still unchecked the above should work .


--
www.phpwhois.co.uk
liamo

2006-11-28, 9:57 pm

ok i made changes but the problem was the $homer_01 its just $homer01
: ) all better grazi again vunderbar cheers
liam

Krustov wrote:
> <comp.lang.php>
> <Geoff Berrow>
> <Wed, 29 Nov 2006 01:09:02 +0000>
> <t1npm29rrccs5m5oegrt0h49ft1htbuhee@4ax.com>
>
>
> Opps - guess i really should check stuff first :-)
>
> $homer_** should be used instead of $krusty_**
>
> $mailbody ="This email was sent via the website form" . "\n\n";
> $mailbody .="DATE: " . "$datesent" . "\n\n";
> $mailbody .="IP: " . "$ip" . "\n\n";
> $mailbody .="Full Name: " . "$homer_01" . "\n\n";
> $mailbody .="Email Address: " . "$homer_02" . "\n\n";
> $mailbody .="Contact Number: " . "$homer_03" . "\n\n";
> $mailbody .="Full Address (job location) : " . "$homer_04" . "\n\n";
> $mailbody .="Interior {box): " . "$marge5" . "\n\n";
> $mailbody .="Exterior {box): " . "$marge6" . "\n\n";
> $mailbody .="Both {box): " . "$marge7" . "\n\n";
> $mailbody .="Dont Know {box): " . "$marge8" . "\n\n";
> $mailbody .="Interior Job: " . "$homer_09" . "\n\n";
> $mailbody .="Exterior Job: " . "$homer_10" . "\n\n";
> $mailbody .="Job Description: " . "$homer_11" . "\n\n";
>
> Although still unchecked the above should work .
>
>
> --
> www.phpwhois.co.uk


Krustov

2006-11-28, 9:57 pm

<comp.lang.php>
<liamo>
<28 Nov 2006 18:39:49 -0800>
<1164767989.568732.231100@80g2000cwy.googlegroups.com>

> ok i made changes but the problem was the $homer_01 its just $homer01
> : ) all better grazi again vunderbar cheers
> liam
>


LOL so it was .

There is a plus side to all these errors of course , Look at the skills
you had a couple of hours ago and look at the skills you have now .

- you have learnt a bit more about forms

- you have learn some tracking / debugging stuff


--
www.phpwhois.co.uk
liamo

2006-11-28, 9:57 pm

i know and it is actually quite easy to look at and see how it all
works
i have replaced all the krusty values with my own so i recognise them
to validate with javascript.
still working :)



Krustov wrote:
> <comp.lang.php>
> <liamo>
> <28 Nov 2006 18:39:49 -0800>
> <1164767989.568732.231100@80g2000cwy.googlegroups.com>
>
>
> LOL so it was .
>
> There is a plus side to all these errors of course , Look at the skills
> you had a couple of hours ago and look at the skills you have now .
>
> - you have learnt a bit more about forms
>
> - you have learn some tracking / debugging stuff
>
>
> --
> www.phpwhois.co.uk


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com