Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

php web form script stopped working

upgrade from 4.0.0 to 4.2.3



6:44 pm on Dec 31, 2002 (gmt 0)

10+ Year Member

Hi -

I am new to PHP and have a simple web form that was sending data via email. The web server here was recently upgraded, including an upgrade from PHP 4.0.0 to 4.2.3. Since then script tells me that there is no data submitted.

Does anyone know if there is something new in 4.2.3 that could cause this problem?

Any help that can be offered is MUCH appreciated!
thank you -
- wa

Form example:

<form action="it_app.php" method="post">
<input type="hidden" name="formproc[email]" value="name@domain.com">
First name: <input type="text" name="formdata[firstname]"><br />
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Reset" value="Reset">

Script is as follows:


$formresults = "";

/* convert the form data into a string */

if (isset($formdata)) {
foreach ($formdata as $key => $value) {
$formresults .= sprintf("$key: $value\n");
} else {
exit ("No form data to process.");

/* determine if this should be emailed or filed */

if (isset($formproc["email"])) {
// form data should be emailed

/* change to match what you want the default values to be */
$emfrm = "applicant";
$emsubj = "web develeopment position";
if (isset($formproc["subject"])) $emsubj = $formproc["subject"];
if (isset($formproc["from"])) $emfrm = $formproc["from"];
mail($formproc["email"],$emsubj,$formresults,"From: $emfrm") or
exit("Unable to email results");

} elseif (isset($formproc["file"])) {
// form data should be appended to a file

$fp = fopen($formproc["file"],"a") or exit("Unable to open " . $formproc
$fw = fwrite($fp,$formresults) or exit("Unable to write to " . $formproc

} else {
// neither were set, issue an error message.
exit ("You must specify a destination for the form data (either email or

/* now check for the success variable and if it's set, issue a header,
otherwise, issue a standard success message.

if (isset($formproc["success"])) {
header("Location: " . $formproc["success"]);
} else {
header("Location: app_submitted.html");

[edited by: jatar_k at 6:12 pm (utc) on Jan. 2, 2003]
[edit reason] removed specifics [/edit]


6:53 pm on Dec 31, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

As shown, before PHP 4.2.0 the default value for register_globals was on. And, in PHP 3 it was always on. The PHP community is encouraging all to not rely on this directive as it's preferred to assume it's off and code accordingly.


You should use PHP´s new suberglobals [php.net] to access submitted values.



6:53 pm on Dec 31, 2002 (gmt 0)

10+ Year Member

You can try this thread:


It helped me a lot.


6:55 pm on Dec 31, 2002 (gmt 0)

10+ Year Member

You beat me to it, Andreas! The link I sent has to do with the globals setting (my original problem...)



6:58 pm on Dec 31, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

That is the problem here as well princess.

In PHP4.0 the register_globals was on, in PHP4.2 it is off.


Longhaired Genius

8:13 pm on Dec 31, 2002 (gmt 0)

10+ Year Member

I've just installed a freeware mail script today: phpformmail.php.

Easy to configure, works like a dream. I love it!


4:05 pm on Jan 3, 2003 (gmt 0)

10+ Year Member

Hi -
Thank you to everyone that replied, I appreciate it. Now on to try to implement a fix. :)
- wendi

Featured Threads

Hot Threads This Week

Hot Threads This Month