Copy link to clipboard
Copied
Hello,
i have a site with several (plain html) pages for products, on each page there will be a "order" link.
Upon clicking the link it should reach a simple ASP mail form so the person can fill their data(it's a very simple ecommerce if you want) but the form should also send the product data/name(invisible) with it and show it on the contact form, ex "you are placing an order for product [product], please enter your contact details below".
in short, how do i pass a variable from the order link on the product page to the contact page(and display it) so that on submit it delivers the user-inputted fields along with the hidden product name.
thanks in advance,
G.L.
>i don't know how to read the querystring and then
>pass it over to the form post
To assign the querystring value to a local variable
DIM productID
productID = Request.QueryString("productID")
To include in the form:
<input name="productID" type="hidden" value="<% =productID %>">
Copy link to clipboard
Copied
You need to pass it in the querystring:
orderpage.asp?ID=12345
Copy link to clipboard
Copied
bregent, yes, i got that far myself using GET.
but how do i transfer that varibale to the final script?
for example, i have:
product page with link: /contact.asp?productid=10
contact.asp has the input boxes for the user data with POST method to sendmail.asp AND must pass the productid to the email send script
sendmail.asp is the email sending script
i'm lost as to how to make the "contact.asp" page that reads and forwards the productid.
i've been googling for samples of mail scripts and variable passing forms but i'm lost as to how to glue them since the majority of email send examples use a HTML initial contact form.(being a total newbie doesn't helps much either
)
Copy link to clipboard
Copied
Ok, you just need to have the contact.asp have a hidden form field that captures the productID value from the query string. Then when the form is submitted it will contain the user supplied data plus the product ID from the hidden field.
Copy link to clipboard
Copied
so far i have the contact.asp and the resulting sending scrip working but i
don't know how to read the querystring and then pass it over to the form
post(and with what asp command to read that fixed/hidden data.
i've been reading through <form> tag use and there's nothing in it to define hidden variables, tried with <%=Request.QueryString("id")%> in the form tag to no avail in contact.asp i have: <html> <head runat="server"> <title>Formulario de envio</title> </head> <body bgColor="#afafaf">
<font size="5">Formulario de contacto asp</font>
</html
Copy link to clipboard
Copied
>i don't know how to read the querystring and then
>pass it over to the form post
To assign the querystring value to a local variable
DIM productID
productID = Request.QueryString("productID")
To include in the form:
<input name="productID" type="hidden" value="<% =productID %>">
Copy link to clipboard
Copied
it works!, awesome!
I found out how to add that code, i was missing the <% code %> tags.
after that the mail received included the ID as expected, many thanks!.
This is how the form ended up:
<html>
<head runat="server">
<title>Formulario de envio</title>
</head>
<%
DIM ID
ID = Request.QueryString("ID")
%>
<body bgColor="#afafaf">
<strong><font size="5">Formulario de contacto asp</font></strong>
<br>
Query string is: <% =Request.QueryString%>
<form method="post" action="envia2.asp">
<p>
<table>
<tr>
<td>Nombre</td><td><input name="nombre"></td>
</tr>
<tr>
<td>E-mail</td><td><input name="email"></td>
</tr>
<tr>
<td>Comentario</td><td><textarea rows="8" cols="50" name="comentario"></textarea></td>
</tr>
<tr>
<td>ID</td><td><input name="ID" type="hidden" value="<% =ID %>"></td>
</tr>
<tr>
<td>
<input type="submit" value="Enviar"></p>
</td>
</tr>
</table>
</form>
</body>
</html>
Message was edited by: Eliminateur
Copy link to clipboard
Copied
>it works!, awesome!
Excellent!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more