Forum Moderators: coopster

Message Too Old, No Replies

Using Forms!

a question about servers.

         

dreamcatcher

6:57 pm on May 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi guys,

I wrote this simple little contact form that both me and a friend of mine are using on different servers. Now when the 'SEND' button is clicked the script checks if the name field is blank, ie:

if ($_POST['submit'])

{

if ($name == "")

{

echo "Error! Please enter your name";

}

rest of script blah blah

}

Everything works fine on my server, but on my friends server the script never gets passed the name field check even if the user HAS typed in their name.

Any ideas as to what might be causing this?

Thank you.

jatar_k

6:58 pm on May 20, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



maybe they have register_globals off and yours is on?

try

if ($_POST['name'] == "")

daisho

7:00 pm on May 20, 2003 (gmt 0)

10+ Year Member



The failing server most likely doesn't have register globals off.

Change $name to $_REQUEST['name'] (You can also use $_POST['name'] but $_REQUEST includes $_GET $_POST and $_COOKIES).

This will work on both servers.

Also rather than if($_POST['submit']) I'd do if(isset($_POST['submit']))

daisho.

dreamcatcher

7:05 pm on May 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks guys!

:)