Forum Moderators: coopster

Message Too Old, No Replies

Form fields not submitted in php. Any Gurus?

         

techiedude

7:31 am on Sep 29, 2005 (gmt 0)



Hello gurus,

None of the variables passed thru the HTML files once filled are displayed in the process.php

I checked my PHP.ini file it says register_globals=On

Any help please?

I have following 2 files

____________________________________________
TEST.HTM

<form action="process.php" method="post">
Name: <input type="text" name="name" size="20" maxlength="20"><br />
Email: <input type="text" name="email" size="30" maxlength="30"><br />
Subject: <input type="text" name="subject" size="30" maxlength="30"><br />
Text: <textarea name="text" cols="50" rows="10"> </textarea><br />
<input type="submit" name="submit" value="Send">
</form>

_____________________________
Process .PHP

echo $HTTP_POST_VARS['name'] . "-1 line<br>";
echo $_POST['name'] . "-2 line<br>";
echo $_GET['name'] . "-3 line<br>";

_____________________________
What it displays is

-1 line
-2 line
-3 line

whya are the form fields that has been inputed not displayed?

coopster

1:22 pm on Sep 29, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, techiedude.

First, have you considered turning register_globals off if at all possible? The PHP manual explains implications best -- Using Register Globals [php.net]. Besides, you aren't using your variables in that manner anyhow, at least not in this example you have provided.

Next, those variables should indeed be populated. Are you certain you have typed something into the "name" input type? Try checking the $_POST superglobal at the top of your "process" script after a filled in form submittal. The reason I tell you to check the $_POST superglobal is because that is the form method you are using -- <form method="post">.

<?php 
if (isset [php.net]($_POST['submit'])) {
print '<pre>';
print_r [php.net]();
print '</pre>';
exit [php.net];
}
?>

techiedude

2:22 pm on Sep 29, 2005 (gmt 0)



Yes i did check using register_globals=off as well, but it was not working now coming to your code..

I implemented it.. its still giving me blank .

My ini files have following variables set

magic_quotes_gpc On On
magic_quotes_runtime Off Off
magic_quotes_sybase Off Off
max_execution_time 30 30
max_input_time -1 -1
memory_limit 8M 8M
open_basedir /home/httpd/vhosts/testme.com/httpdocs:/tmp no value
output_buffering no value no value
output_handler no value no value
post_max_size 8M 8M
precision 14 14
register_argc_argv On On
register_globals On On

ergophobe

6:09 pm on Sep 29, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



coop forgot a variable in his print_r(). Try this

<?php
if (isset($_POST['submit'])) {
print '<pre>';
print_r($_POST);
print '</pre>';
exit;
}
?>

techiedude

4:44 am on Sep 30, 2005 (gmt 0)



still its coming blank ..is it because of the Temporary url that has been provied by 1&1 hosting?

ergophobe

5:38 pm on Sep 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Basic question - are you sure it's calling the version of process.php you think it's calling? In other words, are you sure that you're uploading to the right directory, etc etc etc.

At the top of process.php, put in a line like
echo "We are here: " . __FILE__;

Usually if I add debugging and I get no output, it's because I've gotten confused using my FTP client. That happens to other people, right? Right?

Anyway, if you are in the right file, somehow the form is not getting submitted. Get rid of the condition that tests for $_POST['submit'] and add in a

print_r($_GET);

and see what you get for output. If nothing else, you can test by calling

http://example.com/process.php?param=test

so that you can verify that it's sending output.