0

I have successfully directed my users to a page that contains their information from a table. Using this code:

<?php foreach ($customers as $row) : ?>
<td onclick="window.location='view_customer.php?customer_id=<?php echo $row['id'] ?>&operation=edit';"> 
</td>                    
<?php endforeach; ?>     

Now they are on view_cutomer.php. The next step would be to redirect the users to another page that also contains their information (the same information). Using a button. The next page is paint.php. I've tried this code, but it does not seem to work. Btw this next page no longer has a table.

 <button onclick="window.location='paint.php?customer_id=<?php echo $row['id'] ?>&operation=edit';" class="rbutton">Paint</button> 

How do i redirect users to a specific page using their ID?

1
  • your $row['id'] is undefined in your view_customer.php Commented Jun 8, 2018 at 2:50

1 Answer 1

1

on the 2nd page the id you want is in the get array (from the url)

<button onclick="window.location='paint.php?customer_id=<?php echo $_GET['customer_id'] ?>&operation=edit';" class="rbutton">Paint</button>

Sign up to request clarification or add additional context in comments.

2 Comments

It takes me to the paint.php, however the content is empty. In the URL the result is: localhost/treat.php?customer_id=&operation=edit. However when I manually input an id number (I.E. ID 7) next to customer_id=7&operation=edit. It works
NVM IT WORKED! THANK YOU

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.