Forum Moderators: coopster

Message Too Old, No Replies

form is not working

         

FromBelgium

4:52 pm on Nov 22, 2006 (gmt 0)

10+ Year Member



My host changed servers and now a simple HTML form is not working! The variables are not given to the next page. What could be a possible cause?

<form name=detail method=post action=confirm-free.php>
<input name=name type=text id=name value=>

ahmedtheking

5:25 pm on Nov 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Check if they've still got PHP working. Also clean up your HTML. Can you post some code to help sort this out?

RonPK

5:55 pm on Nov 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



One possible cause: different settings for PHP's
register_globals
[nl2.php.net].

FromBelgium

7:24 pm on Nov 22, 2006 (gmt 0)

10+ Year Member



This code worked on previous sever:

<?php
echo"
<form name=form1 method=post action=confirm.php>
<input name=quantity type=text id=quantity value=\"".$quantity."\" size=1>
</form>";
?>

the variable $quality will become empty on confirm.php

LifeinAsia

7:34 pm on Nov 22, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Did you view the source when the form page is displayed to verify that $quantity is actually being set?

ramoneguru

7:43 pm on Nov 22, 2006 (gmt 0)

10+ Year Member



Try this:
<?php
echo '<form name="form1" method="POST" action="confirm.php">' . "\n";
echo '<input name="quantity" type="text" id="quantity" value='.$quantity.' size="1">' . "\n";
echo '</form>' . "\n";
?>

Appending the \n to the end of the statement just formats the html a little more nice and its an easy add on w/ a regex.
--Nick

FromBelgium

7:57 pm on Nov 22, 2006 (gmt 0)

10+ Year Member



If I look at the source the parameters are empty.

If I add the code <?php echo $quantity;?> it prints nothing. The value gets empty.

jatar_k

7:58 pm on Nov 22, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



what if you try

<?php echo $_POST['quantity'];?>

eelixduppy

8:00 pm on Nov 22, 2006 (gmt 0)




<?php echo [b]$_POST['quantity'][/b];?>

Try this :)

[edit]
LOL Jatar
Guess I didn't refresh before answering ;)
[/edit]

FromBelgium

8:50 pm on Nov 22, 2006 (gmt 0)

10+ Year Member



We are getting closer:

<?php echo $_POST['quantity'];?> Prints correct value!
<?php echo $quantity;?> Prints nothing!

Why is $quantity empty?

FromBelgium

9:52 pm on Nov 22, 2006 (gmt 0)

10+ Year Member



Thanks all! I fixed the problem by defining each variables:

$variable=$_POST['variable']

eelixduppy

11:12 pm on Nov 22, 2006 (gmt 0)



>>Why is $quantity empty?

Refer to RonPK's post :)

whoisgregg

11:20 pm on Nov 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The good news is your new server has register_globals turned off. Read more about security issues related to this setting here [php.net].