|
Posted by J.O. Aho on 06/13/06 18:07
Gary wrote:
> Hi --
>
> I'm using a PHP form-mail processor to return guestbook entries, website
> order-forms etc. A couple of minor glitches in it; was wondering if any
> PHP'ers could offer some snippets or advice on this?
>
> 1: my form returns with an empty "from" field to my email box. Some ISP
> reject such mails as spam. My form does have an input field named "email",
> and my script has functions to process (below) but they're not passed on
> somehow.
Without the code it's difficult to tell whats wrong, but my guess is that you
may look for the variable in the wrong place, if your from is POST and you use
$_GET['e-mail'], then you won't get the data you was looking for. The same if
you have in the HTML input-tag used name="email", but use $_REQUEST['e-mail']
you will too get an empty value.
> 2: is there a simple function that would discard input fields that are
> empty? On one of my order form pages, there are 20 items, which form a long
> empty list on the form return, if only one item is purchased.
if(!empty($_REQUEST['something'])) {
$mailbody="add that item X\n";
}
> 3: is there a simple way of coding the form to insert line breaks between
> the resulting fields in the email output? Right now all the fields are
> single spaced; be nice to add a couple line breaks to divide up the form
> functionally.
$mailbody="one line of text\n\nnext line is two rows below\n";
\n is for a new line, \n\n is two new lines.
//Aho
Navigation:
[Reply to this message]
|