This is a discussion on "Send variable by pressing hyperlink?" within the PHP Forum section. This forum, and the thread "Send variable by pressing hyperlink? are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Send variable by pressing hyperlink?
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
[SOLVED] Send variable by pressing hyperlink?
Hi, Iīm completely stuck on this one.
I have a search that displays the search results like so: 1. Name __Some short description for that name... 2. Name 2 __Some short description for that name... 3. etc.... or in PHP like so...
Where 'ID' is a integer, auto-increment and primary. What I would like to do here is that when that LINK is clicked a pop-up window should open "show_name.php" and set the variable $id to the corresponding number where "NAME" is in my database. So in show_name.php I can have this code:
How is this possible? I hope this is understandable! To round it up, "show_name.php" should get information from the search result page what NAME to display information about. Note that there are numerous results as shown in the text above. This might be an easy one, i've just been looking at this for to long! Last edited by skuliaxe; Feb 6th, 2008 at 17:16. Reason: Solved by alexgeek |
|
|
|
#2
|
||||
|
||||
|
Re: Send variable by pressing hyperlink?
Can I see your query for the first page please?
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
#3
|
|||
|
|||
|
Re: Send variable by pressing hyperlink?
Here is my query from the Search Results page:
This all would be much easier if every entry in the database would have itīs unique page, but thatīs a big waste of space and I plan on having huge numbers of entries. I have also used something like this (to open the "show_name.php" as a pop-up with no menu and fixed size).
|
|
#4
|
||||
|
||||
|
Re: Send variable by pressing hyperlink?
Try this:
And then in show_name.php:
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
#5
|
|||
|
|||
|
Re: Send variable by pressing hyperlink?
That did the trick, thank you so much for that
I would like to have the following setting on a pop-up window:
In stead of the current link (in first code above) opening the page in the same window, I would like to open it in a pop-up window. Could a java script help here?
|
|
#6
|
||||
|
||||
|
Re: Send variable by pressing hyperlink?
Replace the echo with:
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Last edited by alexgeek; Feb 6th, 2008 at 13:31. |
|
#7
|
|||
|
|||
|
Re: Send variable by pressing hyperlink?
OK, i did something similar to what you suggested:
Here is what I see from the code above and my search results of the letter "a": 1. Name 1 __This is id# 3 __Description........... 2. Name 2 __This is id# 5 __Description........... 3. Name 3 __This is id# 1 __Description............. 4. etc. But every link acts like the $id is "1". Even though the id is printed correctly below the name. When I do a more accurate search like "Name X", and only get ONE result everything works great. No matter if itīs Name 1, 2, 3..... then the link always acts correctly. Any ideas |
|
#8
|
||||
|
||||
|
Re: Send variable by pressing hyperlink?
That would be because you are creating the function in javascript many times, resulting in it being overridden.
try:
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
#9
|
|||
|
|||
|
Re: Send variable by pressing hyperlink?
Thanks a million, you can mark this as SOLVED
Notice now that it was always the last $id that was being sent forward due to the overwriting, right? P.s.: Iīm not good in the programing department (beginner). But every time I get help then I most of the time know why something didn't work before. I hope these problems I was having aren't extremely stupid. I would also like thank you for the extremely fast replies. Last edited by skuliaxe; Feb 6th, 2008 at 17:10. |
|
#10
|
||||
|
||||
|
Re: Send variable by pressing hyperlink?
Btw you can remove this:
Thread Sovlved has been disabled for now
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Last edited by c010depunkk; Feb 7th, 2008 at 06:07. |
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Unable to multiply without pressing button | codeexplorer | JavaScript Forum | 2 | Oct 1st, 2007 11:25 |
| Hyperlink buttons | scoopslack | Flash & Multimedia Forum | 3 | Mar 8th, 2007 13:02 |
| A hyperlink that passes a variable to a page | oz_egirl | Classic ASP | 1 | Jan 18th, 2006 16:23 |
| Two form actions on pressing submit button? | AndyP | Web Page Design | 7 | Jul 25th, 2005 16:25 |