Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass Value of Clicked Link to a Second Page 2

Status
Not open for further replies.

symnow

Programmer
Apr 21, 2009
9
US
I have three basic pages that are populated with information from a database. The first page contains a list of links. When the user selects a link, a second page is opened and certain fields are populated with the product information specific to the link selected.

I have written all the code to populate the fields on each of the pages. So right now, the first page correctly displays all of the links, but I am confused as to how to capture the user's selection and pass that on to the second page to display the requested product information.

Currently, If I open the second page directly (rather than attempting to select a link on the first page) the fields are populated with the first record in the database.

I also need to pass the same value to the third page as was passed to the second page.

I am using VB for the server side scripting and my host does not support global.asa files. The database is MS Access. I'm sure this question has been asked before, but I've been unable to find anything by searching. Any help will be greatly appreciated.
 
however, you do need the ampersand & quotes - because the SQL string will read:

"SELECT tblProduct.* FROM tblProduct WHERE tblProduct.pkeyIDProduct=19rs.Open sql, conn...

Actually, no you don't need the ampersand and quotes at the end, as the "rs.open sql, conn" wil execute as a second line..ASP using linebreaks to determine the next line of code no other special character...

So if I do this:

Code:
strMyName = "vicvirk"
strGreeting = "Hello " & strMyName
response.write strGreeting
^ that is valid code.

the way it's done by the user is

Code:
strMyName = "vic"
strGreeting = "Hello " & strMyName & ""
response.write strGreeting

^ which will still work, but has a little bit of excessive code.


It's the same in almost anylanguage (I don't know them all, but here are a few examples):

Javacript:
Code:
var strMyName = "vicvirk";
var strGreeting = "Hello " + strMyName;
document.write(strGreeting);

PHP:
Code:
$strMyName = "vicvirk";
$strGreeting = "Hello " . $strMyName; 
echo $strGreeting;

C#
Code:
string strMyName = "vicvirk";  
string strGreeting;
strGreeting = "Hello " + strMyName;
lblGreeting.text = strGreeting;


TIP: trying googling the answer before posting, you'll find that more times than not someone else somewhere has had the same request and posted an answer online.
----
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javascript enabled browsers
 
I forgot he was using a numeric variable, which is perfectly acceptable to leave off the trailing ampersand & quotes, however, if he was using a string variable, you would need to close the assignment with the apostrophe:
Code:
'to get the equivilent of:
...myColumn = 'some string text'..."

'would need to do this:
myStrVar = "some string text"
...myColumn = '" & myStrVar & "'..."

if the variable included the closing apostrophe, i suppose you could leave off the trailing &"

i just forgot that he was using an int again, because he switched to using a string a few posts up (report.asp?id=string product name), so you can see what i was getting at.

silly me.

________________________________
Top 10 reasons to procrastinate:
1)
 
i believe you also need a comma before "contact" here:
Code:
<a href="#" name="contact"[COLOR=red],[/color] onClick="fncLnk()"><img class="contact" border="0" src="ContactCard.gif" title="Company contact information" WIDTH="38" HEIGHT="26"></a>
 
sorry, wrong copy. i meant here:
Code:
<script language="javascript">
function fncLnk(){
/// Target url for telephone image
window.open("[URL unfurl="true"]http://Contact.asp"[/URL][COLOR=red],[/color] "contact", "left=369, top=147, toolbar=no, location=no, menubar=no, directories=no, scrollbars=yes, height=300, width=300");
}
</script>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top