Jump to content

Weird problem with posting


Mutley

Recommended Posts

When I submit a form it loads the page again but using ISSET processes the form separately.

 

Now, I have 4 queries, 2 for one event, and 2 for another:

 

if(isset($_GET['race_id_ready']) && $_POST['player1'] || $_POST['player2'] == NULL) {
	$style = $_POST['style'];
	$position = $_GET['p'];
	if($position == '1') {
// Update style:
	$sql1  = "UPDATE `races` SET style1 = '$style' WHERE race_id = '$race_id' LIMIT 1";
	mysql_query($sql1);
// Update user_id:			
	$sql2  = "UPDATE `races` SET player1 = '$user_id' WHERE race_id = '$race_id' LIMIT 1";
	mysql_query($sql2);
	}

	if($position == '2') {
// Update style:
	$sql3  = "UPDATE `races` SET style2 = '$style1' WHERE race_id = '$race_id' LIMIT 1";
	mysql_query($sql3);
// Update user_id:			
	$sql4  = "UPDATE `races` SET player2 = '$user_id' WHERE race_id = '$race_id' LIMIT 1";
	mysql_query($sql4);
	}

 

 

The if($position == '1')..... all works fine.

 

Now with

 

if($position == '2')...... the query to update the $user_id is fine but it won't update the style at all and I have no idea why. It doesn't update the style2 field with that variable but if I put a number, like '1' it will update it fine.

 

Is the $_POST invalid for the 2nd query or something?

 

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/44003-weird-problem-with-posting/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.