This is a discussion on "passing an ID field through to PHP" within the PHP Forum section. This forum, and the thread "passing an ID field through to PHP are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
passing an ID field through to PHP
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
passing an ID field through to PHP
I think this is a PHP question, and not MySQL?
I have a MySQL database which I'm searching via PHP, and it produces a list perfectly well. I want to be able to click on a button on any of the found records in the list, to go to a detail page for that record. I have a problem: The ID field I'm passing as a hidden field is always from the last record in the list, regardless of which record's button I click. I imgaine this is because by the time the button is pressed, the ID field has been incremented? But how do I get round it please? Many thanks in advance. :-) |
|
|
|
|||
|
Re: passing an ID field through to PHP
If it's just an incrementation problem then it's being incremented too early in your script. Just change it so that incrementation occurs after the 'view detail' button has been generated (and its link obviously). Unless I'm missing something it should be as straightforward as that, but as always it helps to see the portion of your code that's performing this step in your application.
|
|
|||
|
Re: passing an ID field through to PHP
Thank you very much.
It wasn't exactly an incrementation problem. I only had one form on the page I was generating, because I didn't realise that you could have more than one. I've now put in one form per button, so the hidden ID field is different for each one, and it works wonderfully. Hmmm, now I've got the search producing a list, and a detail page successfully, I need to learn how to update the data, but that's another thread! Next time I have a question (which won't be very long!), I shall make sure to include the relevant code. :-) |
![]() |
| Tags |
| id fields |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need javascript to set input field value field | jdadwilson | JavaScript Forum | 3 | May 9th, 2007 04:47 |
| Passing a value through forms then using it? | wayned16 | PHP Forum | 1 | Feb 9th, 2007 16:51 |
| Passing a Variable to ASP | Smog36 | Flash & Multimedia Forum | 1 | Sep 13th, 2006 14:05 |
| validate text field to db field | jtesolin | Classic ASP | 1 | Jul 18th, 2006 17:48 |
| Passing Data ... | TheShadow | Classic ASP | 2 | May 30th, 2005 09:31 |