I have this table:(megaoverzicht.php) (I left out the part where it connects to the db)

```
echo "<table border='1'><tr><th>Formulier Id</th><th>Domeinnaam</th><th>Bedrijfsnaam</th><th>Datum</th><th>Periode</th><th>Subtotaal</th><th>Dealernaam</th><th>Offerte Maken</th></tr>";

while($row = mysqli_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['formuliernummer'] . "</td>";
  echo "<td>" . $row['domeinnaam'] . "</td>";
  echo "<td>" . $row['bedrijfsnaam'] . "</td>";
  echo "<td>" . $row['datum'] . "</td>";
  echo "<td>" . $row['periode'] . "</td>";
  echo "<td> &euro; " . $row['subtotaal'] . "</td>";        
  echo "<td>" . $row['dealercontactpersoon'] . "</td>";     
  echo "<td><a href='offertemaken.php?id=" . $row->id . "'>Offerte Maken </a></td>";            
  echo "</tr>";
  }
echo "</table>";

mysqli_close($con);
?>

```

I want to open offertemaken.php when the user clicks on Offerte Maken. It needs to open the form with the data from that row(id).

This is the code from (offertemaken.php)(I left out the part where it connects to the db)

```
<?php
$id=$_POST['id'];
$data = 'SELECT * FROM cypg8_overzicht WHERE id="$id"';  
  $query = mysqli_query($con,$data) or die("Couldn't execute query. ". mysqli_error()); 
  $data2 = mysqli_fetch_array($query); 
?>
<form>
<div class="formcontainer" onmousemove="">
 <input type="text" name="datum" id="datum"                                                                     value="<?php echo $data2[datum]?>">
 <input type="text" name="formuliernummer" id="formuliernummer"                             value="<?php echo $data2[formuliernummer]?>">
 <input type="text" name="periode" id="periode"                                                             value="<?php echo $data2[periode]?>">
 <input type="text" name="domeinnaam" id="domeinnaam"                                                   value="<?php echo $data2[domeinnaam]?>">
 <input type="text" name="bedrijfsnaam" id="bedrijfsnaam"                                           value="<?php echo $data2[bedrijfsnaam]?>">
 <input type="text" name="dealercontactpersoon" id="dealercontactpersoon"           value="<?php echo $data2[dealercontactpersoon]?>">     
</div><!--/.formcontainer-->
</form>

```

I cant get it to work. I am missing something I think! I make an error in the codes below:

```
  echo "<td><a href='offertemaken.php?id=" . $row->id . "'>Offerte Maken </a></td>";

```

---

```
  $id=$_POST['id'];
  $data = 'SELECT * FROM cypg8_overzicht WHERE id="$id"'; 

```

I have been looking at a lot of tutorials but cant understand what i am doing wrong. Here a list to show that i am not just asking but actually have been looking for a solution by myself. 

<http://www.daniweb.com/web-development/php/threads/341921/-php-mysqli-update-database-using-id-syntax-help-requested->
<http://www.codeofaninja.com/2012/01/phpmysqli-update-record.html>

I have looked at many more but i don’t want to bother all of you with an extreme long list of links. And i am not allowed because my rep is not big enough! Dont downvote me please!

**Question**
I want to open offertemaken.php when the user clicks on Offerte Maken. It needs to open the form with the data from that row(id)?

**Edit 1 Getting closer to the endresult**
I found out(thanks to Cuba32) that the link in megaoverzicht.php was doing nothing so i changed the following

```
  <a href='offertemaken.php?id=" . $row->id . "'>

```

to

```
  <a href='offertemaken.php?id=" . $row['id'] . "'>

```

Now it is creating these kind of links:

something/formulieren/overzichten/offertemaken.php?id=24

This is a good thing(i think) but the form that opens is blank so offertemaken.php is doing nothing with the id???

**Edit 2** (Thanks to Cube32)

Since yesterday the code has changed quite a bit. I belive that megaoverzicht.php is finished it sends the link as described in edit 1. The only problem is know in offertemaken.php. Below i will put in the code.

```
 $con = mysqli_connect($server,$username,$password,$database);
 if (!$con){
die('Could not connect: ' . mysqli_error($con));
 }
 mysqli_select_db($con,$database);

 $id=$_GET['id'];
 if($data = mysqli_prepare($con, 'SELECT * FROM cypg8_overzicht WHERE id="?"'))
 {

 /* bind parameters for markers */
 mysqli_stmt_bind_param($data, "s", $id);

 /* execute query */
 mysqli_stmt_execute($data); 
 $data2 = mysqli_stmt_fetch($data);

```

But this code gives me the following error.

Warning: mysqli\_stmt\_bind\_param(): Number of variables doesn't match number of parameters in prepared statement in line 31. Line 31:

```
 mysqli_stmt_bind_param($data, "s", $id);

```

I dont know how to solve this part. I will offcourse be looking on the internet to try and find a solution but if anyone knows it please post it. Thanks in advance.

**Edit 3**<= No more error (Thanks to Your Common Sense)

by changing `WHERE id="?"'` into `WHERE id=?'` i no longer have the error. But still it is not showing anything in the input fields

**Edit 4**<= Getting to confused and going back to original code.

Thanks for everyone who got me so far. But I can't see the forest anymore through the trees. I am going back to the original code and try to solve that. So the code is now as follows:

```
$id=$_GET['id'];
$data = 'SELECT * FROM cypg8_overzicht WHERE id="$id"';  
  $query = mysqli_query($con,$data) or die("Couldn't execute query. ". mysqli_error()); 
  $data2 = mysqli_fetch_array($query);
error_reporting(E_ALL); 

```

But this gives the following errors inside the input fields:

**Notice**: Use of undefined constant formuliernummer - assumed 'formuliernummer' in **offertemaken.php** on line **37**  

This error goes for all the input fields.

**Edit 5**
Fixed this by changing `<?php echo $data2[formuliernummer]?>` to `<?php echo $data2['formuliernummer']?>` but it is still not showing the information.

**Edit 6 THE SOLUTION**

I added the answer to the question below. Just look for answer written by HennySmafter.

**Thanks to:**

Cube32, SITDGNymall, Your Common Sense. Thanks all of you for helping me find the solution.