Forum Moderators: coopster

Message Too Old, No Replies

php form processing

php form update

         

hashur

7:26 pm on Jun 3, 2003 (gmt 0)

10+ Year Member



Hi:

My php forms have just stopped working, upon "submit", i get the same blank form, no fwd email, or "thank you" page is generated, the host said its because the new php release does not support certain older code. I used very basic code. do you have any idea of where to check or which code could it be?
Thanks

jatar_k

7:29 pm on Jun 3, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld hashur,

I would put some money on register_globals now being turned off.

instead of vars like $email you may have to switch to $_POST [php.net]['email'] if the method of your form is post there is also $_GET [php.net] for forms which pass values via the get method.

NameNick

8:16 pm on Jun 3, 2003 (gmt 0)

10+ Year Member



Hashur,

You could try this: Create a .htaccess file in the same folder as your script and add the following line to the .htaccess:

php_flag register_globals on

NN

hashur

8:31 pm on Jun 4, 2003 (gmt 0)

10+ Year Member



Thank you for your quick response:

I did replace the variables with the $POST_[], its still not working. notice that I use $PHP_SELF, is this ok.
this is a sample of code:

Thanks

<?php
if (!$submit ¦¦ (!$POST_['email'] ¦¦!$POST_['body']))
{ if ($submit && (!$POST_['email'] ¦¦!$POST_['body']))
echo "You must fill in both an e-mail address and a message.\n";
?>

<form method="post" action="<?php echo $PHP_SELF;?>">

<p>
<b>Are you contacting us about something that regards the web site?</b><br>
<input type="radio" name="website" value="yes"> Yes<br>
<input type="radio" name="website" value="no"> No
</p>

<p>
What is your e-mail address?<br>
<input type="text" name="email">
</p>

<p>
Type your message to us in the following box:<br>
<textarea name="body" wrap="virtual" rows="10" cols="60"></textarea>
</p>

<input type="submit" name="submit" value="Send" class="default">
</form>

<?php
$email = $POST_['email'];
} else {
$to = "name@domain.com";
if ($POST_['website'] == "yes")
$to = "name@domain.com";
mail($to, "feedback", $POST_['body'], "From: $email");
echo "<p>Your message was sent. Thank you!</p>\n";
}
?>

[edited by: jatar_k at 8:47 pm (utc) on June 4, 2003]
[edit reason] removed specifics [/edit]

jatar_k

8:47 pm on Jun 4, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



try $_POST not $POST_

Timotheos

8:47 pm on Jun 4, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You need the underscore before the POST like $_POST[]

hashur

4:45 pm on Jun 5, 2003 (gmt 0)

10+ Year Member



Thank you for your help, forms are back up.