Jump to content

no get parameters, is my syntax out somwhere?


wright67uk

Recommended Posts

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

?>

Link to comment
Share on other sites

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"/>
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.