You are here: Re: php form help « PHP Programming Language « IT news, forums, messages
Re: php form help

Posted by Tyrone Slothrop on 11/28/06 14:40

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/justfixit/job_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!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация