Pergunta

i discovered, if a form has aname in html, i cannot get variables via $_post . Example;

<form action="" name="form1"  method="POST" accept-charset="UTF-8">
<input type="checkbox" name="checkbox_1" value="1">
</form>

<form action="" name="form1"  method="POST" accept-charset="UTF-8">
<input type="text" name="e_mail" />
</form>

<?php 
$e_mail= $_POST['e_mail'];
 echo "$e_mail";
?>

no matter what i did , didint work. in the end i deleted that "name=form1" and joined the 's together .. like this;;

<form action=""  method="POST" accept-charset="UTF-8"> //deleted name=form1
<input type="checkbox" name="checkbox_1" value="1">

<input type="text" name="e_mail" />
</form>

magically WORKED!! (happy).. dont know why? but it worked..

i just wanted to help if anyone comes across with this NON-ERROR_giving annoyance.

and this is happening When i use dreamWeaver to create table. what a devil dreamWeaver are you.. you really eat all my youth.

Foi útil?

Solução

<form action="" name="form1"  method="POST" accept-charset="UTF-8">
<input type="checkbox" name="checkbox_1" value="1">
<input type="text" name="e_mail" />
<input type="submit" name="submit" value="Submit" />
</form>

<?php 
if(isset($_POST['e_mail'])){
 echo "$e_mail";
}
?>

php will throw an error the way you have it. Also, you would only need 2 forms if you are going to have them process differently.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top