473,382 Members | 1,657 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,382 software developers and data experts.

Passing Variables or Querystrings?

JA
I have this little tell-a-friend script that will send out a link back to
the site. I want to put a link on my product pages that will go to the
script, and have the script display the product name, and have the product
name in the email that goes out, along with a link back to the product page,
instead of just to the general site, and then have the Thank You page
include a link back to the product.

I put it up as a project on a freelancers site. I don't know all that much
about asp, but it seems to me that is should be a simple matter of having
the script request the referring url (for the return links) and requesting -
I don't know - variables or querystrings or something, to get the product
name. The info would be coming from an asp page that gets it's info from the
database, so the needed info would be there in asp brackets already (please
pardon my ignorance :-)).

Am I right about that, or is it more complicated than that? Only 1 bidder
says sure it'll take only a couple of hours, but he is talking about using a
hidden form field to pass the info to the script. And some are talking about
it taking "only" a week to complete, and seem to be making it much more
complicated than I think it should be.

I'd like to know that the programmer actually knew what he was doing before
I hire him, so if anyone can set me straight on how it would work, I'd sure
appreciate it!

JA
Jul 19 '05 #1
4 1667
Assuming your "Sent to a friend" script is ASP, and on the product's page,
include the following in your "action" URL;

&theproduct=<%=Request.QueryString("theproduct" )%>

So for example, if your form's action URL was;

action="index.asp?blnconfirm=1"

You'd change it to;

action="index.asp?blnconfirm=1&theproduct=<%=reque st.querystring("theproduct
")%>"

And in the script that processes the form, you'd use;

<%
strProduct = Request.Querystring("theproduct")
'// Rest of your script
%>

And add strProduct to your link;

<%
strLink = "index.asp?theproduct=" & strProduct
'// .Body is whatever your using to add the body
'// (will depend on what your using to send the mail)
.Body "<a href=" & strLink & ">Some text or whatever your doing</a>"

Response.Write "Thankyou. Please <a href=" & strLink & ">click here</a>
to go back to the product's homepage"
%>

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"JA" <ja*****@kc.rr.com> wrote in message
news:jz*******************@twister.rdc-kc.rr.com...
I have this little tell-a-friend script that will send out a link back to
the site. I want to put a link on my product pages that will go to the
script, and have the script display the product name, and have the product
name in the email that goes out, along with a link back to the product page, instead of just to the general site, and then have the Thank You page
include a link back to the product.

I put it up as a project on a freelancers site. I don't know all that much
about asp, but it seems to me that is should be a simple matter of having
the script request the referring url (for the return links) and requesting - I don't know - variables or querystrings or something, to get the product
name. The info would be coming from an asp page that gets it's info from the database, so the needed info would be there in asp brackets already (please pardon my ignorance :-)).

Am I right about that, or is it more complicated than that? Only 1 bidder
says sure it'll take only a couple of hours, but he is talking about using a hidden form field to pass the info to the script. And some are talking about it taking "only" a week to complete, and seem to be making it much more
complicated than I think it should be.

I'd like to know that the programmer actually knew what he was doing before I hire him, so if anyone can set me straight on how it would work, I'd sure appreciate it!

JA

Jul 19 '05 #2
JA
Steve,

The send-to-friend script is on a separate page. How would that work?
Wouldn't I just have the link from the product page to the script page, and
the script page would request the url using server variables (or however
that works!), and request the product name with something like
<%=request.querystring("theproduct> ")%> only using my actual field names?

Thanks again,
JA
"Steven Burn" <pv*@noyb.com> wrote in message
news:u8***************@TK2MSFTNGP10.phx.gbl...
Assuming your "Sent to a friend" script is ASP, and on the product's page,
include the following in your "action" URL;

&theproduct=<%=Request.QueryString("theproduct" )%>

So for example, if your form's action URL was;

action="index.asp?blnconfirm=1"

You'd change it to;

action="index.asp?blnconfirm=1&theproduct=<%=reque st.querystring("theproduct ")%>"

And in the script that processes the form, you'd use;

<%
strProduct = Request.Querystring("theproduct")
'// Rest of your script
%>

And add strProduct to your link;

<%
strLink = "index.asp?theproduct=" & strProduct
'// .Body is whatever your using to add the body
'// (will depend on what your using to send the mail)
.Body "<a href=" & strLink & ">Some text or whatever your doing</a>"

Response.Write "Thankyou. Please <a href=" & strLink & ">click here</a> to go back to the product's homepage"
%>

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"JA" <ja*****@kc.rr.com> wrote in message
news:jz*******************@twister.rdc-kc.rr.com...
I have this little tell-a-friend script that will send out a link back to the site. I want to put a link on my product pages that will go to the
script, and have the script display the product name, and have the product name in the email that goes out, along with a link back to the product page,
instead of just to the general site, and then have the Thank You page
include a link back to the product.

I put it up as a project on a freelancers site. I don't know all that much about asp, but it seems to me that is should be a simple matter of having the script request the referring url (for the return links) and

requesting -
I don't know - variables or querystrings or something, to get the product name. The info would be coming from an asp page that gets it's info from

the
database, so the needed info would be there in asp brackets already

(please
pardon my ignorance :-)).

Am I right about that, or is it more complicated than that? Only 1 bidder says sure it'll take only a couple of hours, but he is talking about

using a
hidden form field to pass the info to the script. And some are talking

about
it taking "only" a week to complete, and seem to be making it much more
complicated than I think it should be.

I'd like to know that the programmer actually knew what he was doing

before
I hire him, so if anyone can set me straight on how it would work, I'd

sure
appreciate it!

JA


Jul 19 '05 #3
You could do it that way. However, you'd then need to include the product
names etc, in hidden fields as Request.ServerVariables("url") and
Request.ServerVariables("HTTP_REFERER") are not capable of grabbing
querystrings for some reason (or atleast, I've never been able to get them
to do that).

If your script is asp, then it would work just as I mentioned (e.g. include
the request before your script, and add it to the URL you send).

As an example;
<form action="somepage.asp?product=<%=request.querystrin g("theproduct")%>"
method="post">
<input type="text" name="Send_To">
<input type="Submit" value="Send">
</form>

Assuming you have the product's name in a querystring already (easily
changed to whatever your using to grab the product name's if your not using
querystrings).

And the script;

<%
'// somepage.asp

strProduct = request.querystring("product")

'// Assumes the e-mail field on your form is called Send_To
strTo = Request.form("Send_To")

'// Put the product into the link
strLink = "<a href=" & request.servervariables("HTTP_REFERER") & _
"?product=" & strProduct & ">This link was sent to
you</a>"

'// Assumes your using CDONTS to send the e-mail
Dim objCDONTS, strToMail, strSubject, strBody
strSubject = "A link was sent to you from www.yoursite.com"
strToMail = strTo
strBody = "The following link was sent to you from www.yoursite.com" & _
vbcrlf & vbcrlf & strLink
Set objCDONTS = Server.CreateObject("CDONTS.NewMail")
objCDONTS.From = "Your site name <po********@yoursite.com>"
objCDONTS.To = strToMail
objCDONTS.Subject = strSubject
objCDONTS.Body = strBody
objCDONTS.Send
set objCDONTS = Nothing

Response.Write "Thankyou. Please <a href=" & strLink & ">click here</a>
to go back to the product's homepage"
%>

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"JA" <ja*****@kc.rr.com> wrote in message
news:X_******************@twister.rdc-kc.rr.com...
Steve,

The send-to-friend script is on a separate page. How would that work?
Wouldn't I just have the link from the product page to the script page, and the script page would request the url using server variables (or however
that works!), and request the product name with something like
<%=request.querystring("theproduct> ")%> only using my actual field names?

Thanks again,
JA
"Steven Burn" <pv*@noyb.com> wrote in message
news:u8***************@TK2MSFTNGP10.phx.gbl...
Assuming your "Sent to a friend" script is ASP, and on the product's page,
include the following in your "action" URL;

&theproduct=<%=Request.QueryString("theproduct" )%>

So for example, if your form's action URL was;

action="index.asp?blnconfirm=1"

You'd change it to;

action="index.asp?blnconfirm=1&theproduct=<%=reque st.querystring("theproduct
")%>"

And in the script that processes the form, you'd use;

<%
strProduct = Request.Querystring("theproduct")
'// Rest of your script
%>

And add strProduct to your link;

<%
strLink = "index.asp?theproduct=" & strProduct
'// .Body is whatever your using to add the body
'// (will depend on what your using to send the mail)
.Body "<a href=" & strLink & ">Some text or whatever your doing</a>"

Response.Write "Thankyou. Please <a href=" & strLink & ">click

here</a>
to go back to the product's homepage"
%>

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"JA" <ja*****@kc.rr.com> wrote in message
news:jz*******************@twister.rdc-kc.rr.com...
I have this little tell-a-friend script that will send out a link back to the site. I want to put a link on my product pages that will go to the
script, and have the script display the product name, and have the product name in the email that goes out, along with a link back to the product

page,
instead of just to the general site, and then have the Thank You page
include a link back to the product.

I put it up as a project on a freelancers site. I don't know all that much about asp, but it seems to me that is should be a simple matter of having the script request the referring url (for the return links) and

requesting -
I don't know - variables or querystrings or something, to get the product name. The info would be coming from an asp page that gets it's info from the
database, so the needed info would be there in asp brackets already

(please
pardon my ignorance :-)).

Am I right about that, or is it more complicated than that? Only 1 bidder says sure it'll take only a couple of hours, but he is talking about

using
a
hidden form field to pass the info to the script. And some are talking

about
it taking "only" a week to complete, and seem to be making it much

more complicated than I think it should be.

I'd like to know that the programmer actually knew what he was doing

before
I hire him, so if anyone can set me straight on how it would work, I'd

sure
appreciate it!

JA



Jul 19 '05 #4
JA
Thanks Steve,

Somehow I got it going! The only thing I'd like to change is this - is it
possible to go to the script from a link, rather than a submit button? This
is probably something HTML that I've forgotten!
"Steven Burn" <pv*@noyb.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
You could do it that way. However, you'd then need to include the product
names etc, in hidden fields as Request.ServerVariables("url") and
Request.ServerVariables("HTTP_REFERER") are not capable of grabbing
querystrings for some reason (or atleast, I've never been able to get them
to do that).

If your script is asp, then it would work just as I mentioned (e.g. include the request before your script, and add it to the URL you send).

As an example;
<form action="somepage.asp?product=<%=request.querystrin g("theproduct")%>"
method="post">
<input type="text" name="Send_To">
<input type="Submit" value="Send">
</form>

Assuming you have the product's name in a querystring already (easily
changed to whatever your using to grab the product name's if your not using querystrings).

And the script;

<%
'// somepage.asp

strProduct = request.querystring("product")

'// Assumes the e-mail field on your form is called Send_To
strTo = Request.form("Send_To")

'// Put the product into the link
strLink = "<a href=" & request.servervariables("HTTP_REFERER") & _
"?product=" & strProduct & ">This link was sent to
you</a>"

'// Assumes your using CDONTS to send the e-mail
Dim objCDONTS, strToMail, strSubject, strBody
strSubject = "A link was sent to you from www.yoursite.com"
strToMail = strTo
strBody = "The following link was sent to you from www.yoursite.com" & _ vbcrlf & vbcrlf & strLink
Set objCDONTS = Server.CreateObject("CDONTS.NewMail")
objCDONTS.From = "Your site name <po********@yoursite.com>"
objCDONTS.To = strToMail
objCDONTS.Subject = strSubject
objCDONTS.Body = strBody
objCDONTS.Send
set objCDONTS = Nothing

Response.Write "Thankyou. Please <a href=" & strLink & ">click here</a> to go back to the product's homepage"
%>

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"JA" <ja*****@kc.rr.com> wrote in message
news:X_******************@twister.rdc-kc.rr.com...
Steve,

The send-to-friend script is on a separate page. How would that work?
Wouldn't I just have the link from the product page to the script page,

and
the script page would request the url using server variables (or however
that works!), and request the product name with something like
<%=request.querystring("theproduct> ")%> only using my actual field names?

Thanks again,
JA
"Steven Burn" <pv*@noyb.com> wrote in message
news:u8***************@TK2MSFTNGP10.phx.gbl...
Assuming your "Sent to a friend" script is ASP, and on the product's page, include the following in your "action" URL;

&theproduct=<%=Request.QueryString("theproduct" )%>

So for example, if your form's action URL was;

action="index.asp?blnconfirm=1"

You'd change it to;

action="index.asp?blnconfirm=1&theproduct=<%=reque st.querystring("theproduct
")%>"

And in the script that processes the form, you'd use;

<%
strProduct = Request.Querystring("theproduct")
'// Rest of your script
%>

And add strProduct to your link;

<%
strLink = "index.asp?theproduct=" & strProduct
'// .Body is whatever your using to add the body
'// (will depend on what your using to send the mail)
.Body "<a href=" & strLink & ">Some text or whatever your doing</a>"
Response.Write "Thankyou. Please <a href=" & strLink & ">click

here</a>
to go back to the product's homepage"
%>

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"JA" <ja*****@kc.rr.com> wrote in message
news:jz*******************@twister.rdc-kc.rr.com...
> I have this little tell-a-friend script that will send out a link back to
> the site. I want to put a link on my product pages that will go to
the > script, and have the script display the product name, and have the

product
> name in the email that goes out, along with a link back to the product page,
> instead of just to the general site, and then have the Thank You page > include a link back to the product.
>
> I put it up as a project on a freelancers site. I don't know all that
much
> about asp, but it seems to me that is should be a simple matter of

having
> the script request the referring url (for the return links) and
requesting -
> I don't know - variables or querystrings or something, to get the

product
> name. The info would be coming from an asp page that gets it's info

from the
> database, so the needed info would be there in asp brackets already
(please
> pardon my ignorance :-)).
>
> Am I right about that, or is it more complicated than that? Only 1

bidder
> says sure it'll take only a couple of hours, but he is talking about

using
a
> hidden form field to pass the info to the script. And some are
talking about
> it taking "only" a week to complete, and seem to be making it much

more > complicated than I think it should be.
>
> I'd like to know that the programmer actually knew what he was doing
before
> I hire him, so if anyone can set me straight on how it would work, I'd sure
> appreciate it!
>
> JA
>
>



Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: mark4asp | last post by:
What are the best methods for using global constants and variables? I've noticed that many people put all global constants in a file and include that file on every page. This is the best way of...
4
by: Jason Us | last post by:
Does anyone have experience with passing variables from an ASP page to a JSP page. The way it currently works in passing the SSN in the URL. This cannot be good. I thought that storing a...
7
by: Pete | last post by:
Any ideas on how I can set some data in 1.asp, then have 1.asp do a server.transfer (or .execute, come to that) to 2.asp, and have 2.asp access the original data? I'm aware that the Session...
1
by: terry | last post by:
Hi, I have a need to pass a large data chunk (> 1024 bytes) between web forms that reside on different web applications (say one application is http:\\localhost\website1\page1.aspx while the...
7
by: Gerald | last post by:
Hi, Is there any know problem using session variables ? My website won't have more than 20 simultaneous connections, and i would like to use 5 session variables containing strings... I know...
7
by: Smokey Grindle | last post by:
For a website that has users logged into it using sessions, its it best to pass data between pages in session variables or through query strings?
6
by: Kausar | last post by:
Hello All, How do i pass the value from a page that exists on some domain to another page that exists in subdomain. Regards Kausar
4
by: Sam | last post by:
I have an asp.net 2.0 app that uses a sitemap, Master Page, and has several content pages. While this feature has simplified the process of creating a data-driven site menu, it does seem to have...
1
abehm
by: abehm | last post by:
Hi, I'm trying to pass multiple values through querystrings to another page where i will parse them to individual variables. I have one method to create the querystrings before they pass, but for...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.