Mutley Posted March 23, 2007 Share Posted March 23, 2007 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 More sharing options...
per1os Posted March 23, 2007 Share Posted March 23, 2007 if($position == '2') { // Update style: $sql3 = "UPDATE `races` SET style2 = '$style1' WHERE race_id = '$race_id' LIMIT 1"; Where does $style1 get set? Link to comment https://forums.phpfreaks.com/topic/44003-weird-problem-with-posting/#findComment-213662 Share on other sites More sharing options...
Mutley Posted March 23, 2007 Author Share Posted March 23, 2007 That is supposed to be $style (I was testing if the varible works if different to the first event). So it is supposed to be $style but still does not work. Link to comment https://forums.phpfreaks.com/topic/44003-weird-problem-with-posting/#findComment-213671 Share on other sites More sharing options...
Mutley Posted March 23, 2007 Author Share Posted March 23, 2007 UPDATE `races` SET style2 = '' WHERE race_id = '1' That's what I get once echoed. Link to comment https://forums.phpfreaks.com/topic/44003-weird-problem-with-posting/#findComment-213673 Share on other sites More sharing options...
per1os Posted March 23, 2007 Share Posted March 23, 2007 Than the issue lies within the $_POST['style']. Without the form or how the data is gathered it is hard to diagnose. Link to comment https://forums.phpfreaks.com/topic/44003-weird-problem-with-posting/#findComment-213733 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.