468,275 Members | 1,788 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,275 developers. It's quick & easy.

Trouble with PHP formmail

Hi, I'm using PHP 4.4.4 and have downloaded the free script
formmail.php (version 4.1b). Wondered if anyone had experienced the
same problem I'm having. I'm submitting a form to formmail.php, but
none of the variables seem to be getting recognized. Here is part of
the form I'm submitting ...

<body onload="document.forms[0].submit();">
Sending Order ...

<form action="formmail.php" method=post
enctype="application/x-www-form-urlencoded">
<INPUT TYPE="hidden" NAME="subject" VALUE="Order for Coffee">
<INPUT TYPE="hidden" NAME="redirect" VALUE="thanks.html">
<INPUT TYPE="hidden" NAME="recipient"
VALUE="la***********@gmail.com">
....
</form>
</body>
but then I get warnings like below ...

Notice: Undefined variable: recipient in
/usr/local/apache2/htdocs/andersonscoffee/formmail.php on line 365

Notice: Undefined variable: required in
/usr/local/apache2/htdocs/andersonscoffee/formmail.php on line 383

Notice: Undefined variable: require in
/usr/local/apache2/htdocs/andersonscoffee/formmail.php on line 388

Notice: Undefined variable: email in
/usr/local/apache2/htdocs/andersonscoffee/formmail.php on line 429

but as you can see above, "recipient" and "email" are clearly defined.
What am I doing wrong?

Thanks, - Dave

Nov 6 '06 #1
4 2821

la***********@zipmail.com wrote:
Hi, I'm using PHP 4.4.4 and have downloaded the free script
formmail.php (version 4.1b). Wondered if anyone had experienced the
same problem I'm having. I'm submitting a form to formmail.php, but
none of the variables seem to be getting recognized. Here is part of
the form I'm submitting ...

<body onload="document.forms[0].submit();">
Sending Order ...

<form action="formmail.php" method=post
enctype="application/x-www-form-urlencoded">
<INPUT TYPE="hidden" NAME="subject" VALUE="Order for Coffee">
<INPUT TYPE="hidden" NAME="redirect" VALUE="thanks.html">
<INPUT TYPE="hidden" NAME="recipient"
VALUE="la***********@gmail.com">
...
</form>
</body>
but then I get warnings like below ...

Notice: Undefined variable: recipient in
/usr/local/apache2/htdocs/andersonscoffee/formmail.php on line 365

Notice: Undefined variable: required in
/usr/local/apache2/htdocs/andersonscoffee/formmail.php on line 383

Notice: Undefined variable: require in
/usr/local/apache2/htdocs/andersonscoffee/formmail.php on line 388

Notice: Undefined variable: email in
/usr/local/apache2/htdocs/andersonscoffee/formmail.php on line 429

but as you can see above, "recipient" and "email" are clearly defined.
What am I doing wrong?

Thanks, - Dave
The script you've downloaded likely requires register_globals to be
enabled (bad) and your server has it disabled (good). Either turn it
on in php.ini (bad) or get a newer version of the script that doesn't
require it (good). If there isn't a version of formmail.php that
doesn't require register globals then I'd look for another script.

Nov 6 '06 #2
On 6 Nov 2006 08:06:32 -0800, "la***********@zipmail.com"
<la***********@zipmail.comwrote:
>Hi, I'm using PHP 4.4.4 and have downloaded the free script
formmail.php (version 4.1b). Wondered if anyone had experienced the
same problem I'm having. I'm submitting a form to formmail.php, but
none of the variables seem to be getting recognized. Here is part of
the form I'm submitting ...

<body onload="document.forms[0].submit();">
Sending Order ...

<form action="formmail.php" method=post
enctype="application/x-www-form-urlencoded">
<INPUT TYPE="hidden" NAME="subject" VALUE="Order for Coffee">
<INPUT TYPE="hidden" NAME="redirect" VALUE="thanks.html">
<INPUT TYPE="hidden" NAME="recipient"
VALUE="la***********@gmail.com">
...
</form>
</body>
but then I get warnings like below ...

Notice: Undefined variable: recipient in
/usr/local/apache2/htdocs/andersonscoffee/formmail.php on line 365

but as you can see above, "recipient" and "email" are clearly defined.
They're not clearly defined at all. They're in your form, but that doesn't
mean there will be a $recipient variable.

The script should be looking in $_POST['recipient'], etc., and if it's not,
then it's assuming the deprecated and potentially dangerous "register_globals"
option is on (search the manual or Google for more info), and so the script is
very old and hasn't been updated for the past several years of changes in PHP.

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Nov 6 '06 #3
"ZeldorBlat" <ze********@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
>
la***********@zipmail.com wrote:
>Hi, I'm using PHP 4.4.4 and have downloaded the free script
formmail.php (version 4.1b). Wondered if anyone had experienced the
same problem I'm having. I'm submitting a form to formmail.php, but
none of the variables seem to be getting recognized. Here is part of
the form I'm submitting ...

<body onload="document.forms[0].submit();">
Sending Order ...

<form action="formmail.php" method=post
enctype="application/x-www-form-urlencoded">
<INPUT TYPE="hidden" NAME="subject" VALUE="Order for Coffee">
<INPUT TYPE="hidden" NAME="redirect" VALUE="thanks.html">
<INPUT TYPE="hidden" NAME="recipient"
VALUE="la***********@gmail.com">
...
</form>
</body>

The script you've downloaded likely requires register_globals to be
enabled (bad) and your server has it disabled (good). Either turn it
on in php.ini (bad) or get a newer version of the script that doesn't
require it (good). If there isn't a version of formmail.php that
doesn't require register globals then I'd look for another script.
I'd look for another script in any case. That one is the kind of that
spammers exploit to deliver their junkmail to people. Recipient in a hidden
field, come on!! It will become a spam relay faster than you can say
supercalifragilisticexpialidocious... >:(
--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
sp**@outolempi.net | rot13(xv***@bhgbyrzcv.arg)
Nov 7 '06 #4
Those are just Notices about undefined variables, if you don't want to
go over the script and you don't want to see them just change your
error reporting level to E_ALL & ~E_NOTICE in your PHP.ini file (or
just for the script in question).
Personally I'd try to fix the variables in question but that is up to
the individual developer as they are not critical errors or faults.

Nov 7 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by mcp6453 | last post: by
1 post views Thread by Kurt | last post: by
reply views Thread by Craig | last post: by
4 posts views Thread by Hmmm... | last post: by
5 posts views Thread by John Oliver | last post: by
reply views Thread by Aidan | last post: by
3 posts views Thread by Geoff Cox | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by zattat | last post: by
1 post views Thread by MrBee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.