Jump to content

[SOLVED] Lost post vars


tr33b1rd

Recommended Posts

I have a PHP script that processes post data and displays the posted data on a confirmation page. The script works for me 100%. My client will use it and it will work for x amount of time, but then the post variables start to get lost. The success page displays with nothing on it. It seems like the post variables are not being sent to the server.

 

Can anybody give me any reasons why post data would not be sent? I'm thinking it could be everything from the computer (i've had them use different browsers), the router, the modem, the ISP. And I have no idea where to start troubleshooting other than in their office, because that is the only place the problem occurs.

Link to comment
Share on other sites

Okay, my client has tested this outside their building themselfs, and it worked 100%. The problem still occurs in their building. I put some error messages in to better troubleshoot and now i'm really confused. The response on failure is "Error 2".

 

Here's the code, I shortened the querys a bit, but there are about 20 post vars going into corrisponding MySQL fields. At this point we are only troubleshooting the INSERT query.

 

if ($_POST['type'] == 'update') {
$SQL = "UPDATE partners SET name = '".$_POST['name']."', address = '".$_POST['address']."' WHERE id = ".$_POST['id'];
mysql_query($SQL);
$id = $_POST['id'];
} else if ($_POST['type'] == 'insert') {
$SQL = "INSERT INTO partners (id, name, address) VALUES ('','".$_POST['name']."','".$_POST['address']."')";
mysql_query($SQL);
$id = mysql_insert_id(); 
} else {
print 'Error 1';
}
if ($id != NULL){
header('location:success.php?t='.$_POST['type'].'&id='.$id);
} else {
print 'Error 2';
}

 

$_POST['type'] is a hidden field to define what query to use.

 

The type post variable is present, otherwise "Error 1" would be returned.

 

$id is not set with:    $id = mysql_insert_id();

This is because nothing is inserted into the database.

The result is "Error 2".

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.