passing an ID field through to PHP

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.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Nov 18th, 2006, 09:16
Junior Member
Join Date: Feb 2006
Location: West Yorks, UK
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
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. :-)
Reply With Quote

  #2 (permalink)  
Old Nov 20th, 2006, 06:10
Up'n'Coming Member
Join Date: Nov 2006
Location: United Kingdom
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to scribbz
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.
Reply With Quote
  #3 (permalink)  
Old Nov 20th, 2006, 08:24
Junior Member
Join Date: Feb 2006
Location: West Yorks, UK
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
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. :-)
Reply With Quote
Reply

Tags
id fields

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT. The time now is 21:18.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43