problems with form

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I am having difficulty with a form processing script.
This cut down version also exhibits the problem
The idea is to input the data and then click the submit button  
to process it, but it just reloads the form.

Can anyone point out where I am going wrong?
In case there is an effect I am running it on a linux machine
on my desktop via
The file is called pdcd1.php,so it calls itself.

if (!$submitm)
<form method="post" action="pfcd1.php" name="main">
print"<input type=\"radio\" name=\"mastercontrol\" value=\"on\">";

<input type="submit" name="submitm" value="submitm"></form>
print "<html><br>";
print "PROCESSED";

Neil Jones

Re: problems with form

The variable $submitm is were you are going wrong.

if you replace it with $_POST['submitm'] then I am pretty sure your
script will execute as expected.

Reason: There is a definition in your php.ini file that is called
'register_globals'. If it is off variables submitted by forms or by the
URL itself (index.php?get=variable) will not be accessabile by using a
simple variable. You will need to first reference the array that they
are in:

$_POST for post variables and,
$_GET for get :)

This is disabled by default (I believe) for security reasons.

Re: problems with form wrote:

Quoted text here. Click to load it

Thanks.  I was really puzzled by this as this set up had always worked on
servers for me. I just copied an existing file. I thought it must be
something related to the actual environment but sometimes you just can't
see errors.

Thanks for the rapid reply too.

Neil Jones

Site Timeline