The php post is returning wrong value
I have wrote the code like this
<?php
echo "Add1:".$_POST['Address1'];
echo "<br>";开发者_开发知识库
echo "Add2:".$_POST['Address2'];
?>
<FORM name="myForm" method='post'>
<table>
<tr>
<td>Address 1</td>
<td><input type="text" name="Address1"></td>
</tr>
<tr>
<td>Address2</td>
<td><input type="text" name="Address2"></td>
</tr>
</table>
<input type="submit">
</FORM>
When enter a value as some thing like this
Address1 = test <test1 and Address2=address2:
But in post i got only the Address1 value in both post variable like.
Add1:test
Add2:test1
Any one can help me.
Debug what you're getting via
<?php print_r($_POST);
and you'll see if it is PHP releated problem or the problem lays somewhere else
Based on your example, it doesn't look like it's not working (Add1 and Add2 are different). What happens if you do a var_dump($_POST)
?
If $_POST['Address2']
wasn't filled through the form, it is empty, no output should be displayed.
Try var_dump($_POST);
to check the whole POST-array and/or use tools like Firebug, to see which data was sent to the actually.
you can have exact idea by writing this code
<?php
echo "<pre>";print_r($_POST);echo "</pre>";
echo "Add1:".$_POST['Address1'];
echo "<br>";
echo "Add2:".$_POST['Address2'];
?>
that will emable you to check what exactly is coming in $_POST
精彩评论