Page 1 of 1

dont recieve values in $_POST variables

Posted: Mon May 31, 2010 5:27 am
by diyasher
i dont recieve values in $_POST variables in all browsers except IE, it works in in IE well.

<form name="form_editoffs" method="post" action="editoffs.php" onsubmit="return validation();">
<input type="text" name="txt_date" id="txt_date" size="20" value="<?php echo $row['offs_date'];?>" readonly="readonly" />
<input type="text" name="txt_desc" id="txt_desc" size="75" value="<?php echo $row['offs_desc'];?>" />
<input type="submit" value="Update" name="btn_submit" />
</form>


<?php
if(isset($_POST['btn_submit']))
{
$offsh = null;
$offsd = null;

if(empty($_POST['txt_date']) || empty($_POST['txt_desc']))
{
echo $_POST['txt_date'];
echo $_POST['txt_desc'];
//echo "<font face='calibri' size=2>Please enter date or event/description</font>";
}

else
{
$offsh = $_POST['txt_date'];
$offsd = $_POST['txt_desc'];
}

$offsh = addslashes($offsh);
$offsd = addslashes($offsd);

}
?>

Re: dont recieve values in $_POST variables

Posted: Mon May 31, 2010 7:06 am
by internet-solution
Since the issue is different in different browsers, my guess is that it is a javascript issue. Can you post your javascript function validation() ?

Re: dont recieve values in $_POST variables

Posted: Mon May 31, 2010 4:26 pm
by phdatabase
Just as a general debugging note:

When I have this problem (and I do, a lot) I have a hunk of code I put at the top of the page that receives the FORM code.
Here it is:

echo"<pre>";
print_r($_POST);
print"</pre>;

First thing is find if the fault is in the form or the processing code.

Re: dont recieve values in $_POST variables

Posted: Mon May 31, 2010 4:58 pm
by pickle
phdatabase wrote:Just as a general debugging note:

When I have this problem (and I do, a lot) I have a hunk of code I put at the top of the page that receives the FORM code.
Here it is:

echo"<pre>";
print_r($_POST);
print"</pre>;

First thing is find if the fault is in the form or the processing code.
My dump_array function does this, and includes file & line numbers so you don't forget where you called it from.