473,385 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Get dynamic link's name with onClick?

6
Hi all,
I run a query in PHP on an existing database and convert resulting records (OrderNumbers) into hyperlinks. This spits out a number of results so the user can click any of the links. I would like to be able to click on the link and load the link's name into variable, so I can run another query using this variable later on. Or really just load the link's name into a hidden form field, whatever.

E.g. how can you? <a href="javascript:void(0)" onclick="Get the 'test' value and load it into variable or hidden form field?">test</a>
Below is the code generating links.

[PHP]
$rs=odbc_exec($conn,$sql);
if (!$rs)
{exit("Error in SQL");}
echo "<table><tr>";
echo "<th>Order Numbers Found:</th>";
"<th>Total Qty</th></tr>";
while (odbc_fetch_row($rs))
{
$orderno=odbc_result($rs,"OrderNo");
$qty=odbc_result($rs,"BuyQty");
echo "<tr><td>". "<a href=\"$orderno\">$orderno</a>" . "</td>";
echo "<td>$qty</td></tr>";}[/PHP]

Thanks
Speedy
Aug 20 '06 #1
3 3663
Speedy
6
OK after reading quite a few articles about this issue I think I can answer myself and say it is most probably not possible to do it the way I want to.

INSTEAD:
Could you please help me with using the existing code and load the OrderNumbers into an option box on the form?

Thank you
Speedy
Aug 21 '06 #2
ronverdonk
4,258 Expert 4TB
Must be something like this, I presume?

[PHP] echo '<select name="myselect">';
while (odbc_fetch_row($rs)) {
$orderno=odbc_result($rs,"OrderNo");
$qty=odbc_result($rs,"BuyQty");
echo "<option value='$orderno'>$orderno</option>";
}
echo '</select>';
[/PHP]

Ronald :cool:
Aug 21 '06 #3
Speedy
6
Hi ronverdonk,
thanks for your reply. I figured how to load it into the option box already, but another user "iam_clint" helped me to use my preferred solution using the 'href's' attribute 'name'.
I then use this to run the detailed query and display details.

[PHP]echo "<a href=\"order_detail.php?name=$OrderNumber\">$Order Number</a>";[/PHP]

Speedy
Aug 22 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: John Ortt | last post by:
I appologise for reposting this but I have been trying to find a solution all week with no avail and I was hoping a repost might help somebody more knowledgable than myself to spot the message... ...
6
by: hsomob1999 | last post by:
so i have a <ul> and I allow the user to append items to it. The problem is that on mozilla the <span class="line"> which is just a line to divide the sections gets overlaped and doesnt move down...
3
by: Aaron Gervais | last post by:
I am brand-new to javascript, but after reading some tutorials online I was able to make a dynamic HTML photo gallery in javascript. It works fine in all browsers except IE6 (big surprise). I've...
1
by: nsvmani | last post by:
Hi, i am trying to get the FileOpen dialogue window as soon as clicked href link I am using IE6 with ActiveX enabled. Just need to get the File Open dialogue window when i click on the HREF links.It...
1
by: philin007 | last post by:
Hi , I am having a page where leave is applied. - In this page 1 new rows is created dynamically everytime the 'Add row' button is pressed - Each row has a begin date text field and beside it a...
3
polymorphic
by: polymorphic | last post by:
I have succeeded in embedding PDF files in a dynamic iframe. The problem is that I need the PDF to cache. If the PDF remains the same from page load to page load then the pdf is somehow cached with...
0
bmallett
by: bmallett | last post by:
First off, i would like to thank everyone for any and all help with this. That being said, I am having a problem retrieving/posting my dynamic form data. I have a form that has multiple options...
1
by: skyson2ye | last post by:
Hi, guys: I have written a piece of code which utilizes Javascript in PHP to create a three level dynamic list box(Country, States/Province, Market). However, I have encountered a strange problem,...
1
by: chaitanyadotcom | last post by:
As per my application i need to create tabs using iFrame dynamically. There are totally 4 buttons in my application where for each button i provide a link. Where in it will dynamically create a tab...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.