wright67uk Posted April 28, 2013 Share Posted April 28, 2013 For some reason i'm not passing any get parameters. Is my syntax out? (line 33) I'm using dreamweaver's syntax highlighter and it isn't showing any errors. The form takes me to: URL/update_win.php? (note no 'id= ? ' Any help would be great. <?php //connection if ($mysqli->connect_error) { die('Connect Error: ' . $mysqli->connect_error); } $query = "SELECT id, date, horse, course, odds, time, tip, description FROM toptips order by date desc"; $result = $mysqli->query($query); while($row = $result->fetch_array()) { $rows[] = $row; } foreach($rows as $row) { $date = $row['date']; $date = date("d/m/y", strtotime($date)); $id = $row['id']; echo '<div style= "width:600px;"> <div style="float:left; width:400px; margin-bottom:10px; margin-top10px;"> ('.$date.") " . $row['time'] . " " . $row['course'] . " - " . $row['horse'] . " " . $row['odds'] . " " . '<img src="' . $row['tip'] . '.png" alt=" '. $row['tip'] .' " height="42" width="42" style="float:right"><br>'. $row['description'] . '</div> <div style= "float:right; width: 50px; margin-left:150px;"> <form method="get" action="update_win.php?id='.$id.'"> <input type="submit" value="add win"/> </form> </div> </div> <div style="clear:both"/> <hr/>' ; } $result->close(); $mysqli->close(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/277390-no-get-parameters-is-my-syntax-out-somwhere/ Share on other sites More sharing options...
akphidelt2007 Posted April 28, 2013 Share Posted April 28, 2013 When using the GET method the form creates the query string in the url through it's inputs. So the query string in your action gets erased. You can create a hidden input field and assign the id value to it. Sort of like <form method="get" action="update_win.php"> <input type="hidden" value="'.$id.'" name="id"> <input type="submit" value="add win"/> Quote Link to comment https://forums.phpfreaks.com/topic/277390-no-get-parameters-is-my-syntax-out-somwhere/#findComment-1427017 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.