dont recieve values in $_POST variables

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
diyasher
Forum Newbie
Posts: 1
Joined: Mon May 31, 2010 5:17 am

dont recieve values in $_POST variables

Post 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);

}
?>
internet-solution
Forum Contributor
Posts: 220
Joined: Thu May 27, 2010 6:27 am
Location: UK

Re: dont recieve values in $_POST variables

Post 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() ?
User avatar
phdatabase
Forum Commoner
Posts: 83
Joined: Fri May 28, 2010 10:02 am
Location: Fort Myers, FL

Re: dont recieve values in $_POST variables

Post 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.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: dont recieve values in $_POST variables

Post 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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply