Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

HTML Form - not passing parameters

Posted on 2011-10-06
4
Medium Priority
?
369 Views
Last Modified: 2012-05-12
My HTML form, with filefields is not posting  data,

I've set up two test pages, one with a form and one that recieves the data the first is -

<!--#include file="../Connections/Connection.asp" -->
<!--#include file="../ScriptLibrary/incPU3Class.asp" -->
<!--#include file="../ScriptLibrary/incPU3Utils.asp" -->
<!--#include file="includes/Product-Edit-RS/Select-AdditionalImages.asp" -->
<!--#include file="includes/Product-Edit-RS/Select-Product.asp" -->
<!--#include file="includes/Product-Edit-RS/Select-MainImage.asp" -->
<!--include file="includes/editproduct-image-upload.asp" -->
<!--include file="includes/product-update.asp" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<form action="test2.asp" method="post" enctype="multipart/form-data" name="newprodust" id="newprodust" onSubmit="return validatenewprodust(this)">
    <strong>Product Details</strong>
    <table border="0" cellspacing="0" cellpadding="0" class="newproducttable">
      <tr>
        <td class="fixedleftwidth">Product ID</td>
        <td><input name="id" type="text" id="id" value="id here" /></td>
      </tr>
      <tr>
        <td class="fixedleftwidth">Product Name</td>
        <td><input name="name" type="text" id="name" value="namehere" /></td>
      </tr>
      <tr>
        <td class="fixedleftwidth">Main Image <span class="asterix">*</span></td>
        <td><input name="image1" type="file" id="image1" value="imagehere"/></td>
      </tr>
      <tr class="alternativerowtr">
        <td class="fixedleftwidth">Second Image (Optional)</td>
        <td><input name="image2" type="file" id="image2" value="imagehere2" /></td>
      </tr>
      <tr>
        <td class="fixedleftwidth">Third Image (Optional)</td>
        <td><input name="image3" type="file" id="image3" value="imagehere3" /></td>
      </tr>
      <tr class="alternativerowtr">
        <td class="fixedleftwidth">Fourth Image (Optional)</td>
        <td><input name="image4" type="file" id="image4" value="imagehere4" /></td>
      </tr>
      <tr>
        <td class="fixedleftwidth">Fifth Image (Optional)</td>
        <td><input name="image5" type="file" id="image5" value="imagehere5" /></td>
      </tr>
      <tr class="alternativerowtr">
        <td class="fixedleftwidth">Sixth Image (Optional)</td>
        <td><input name="image6" type="file" id="image6" value="imagehere6" /></td>
      </tr>
  </table>
    <input type="submit" name="button" id="button" value="Submit" />
<input name="faction" type="hidden" id="faction" value="fupdate" />
</form>
</body>
</html>

Open in new window


the second is (test2.asp) -

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<p>ID : <%= Request.Form("id") %></p>
<p>Name : <%= Request.Form("name") %></p>
<p>Main Image : <%= Request.Form("image1") %></p>
<p>Image 2:</p>
<p>Image 3:</p>
<p>Image 4:</p>
<p>Image 5:</p>
<p>Image 6:</p>
<p>&nbsp;</p>
</body>
</html>

Open in new window


Nothing is getting sent across...

This is the first time I have experienced an issue like this, please advise.

Thank you
0
Comment
Question by:garethtnash
  • 2
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
pateljitu earned 2000 total points
ID: 36925529
As your <FORM> contains attribute enctype="multipart/form-data" Request.Form would not work, please see this article for further reference:
http://www.15seconds.com/issue/981121.htm

Also you can use this free upload component for classic ASP:
http://www.freeaspupload.net/freeaspupload/download.asp
0
 

Author Comment

by:garethtnash
ID: 36930308
You are totally correct thank you, mind if I quickly ask you another quick question?

you may recall helping me with the following multi select combi box -

<select name="category" size="4" multiple="multiple" id="category">
<%
While (NOT RsCategoriesOptions.EOF)
%><option value="<%=(RsCategoriesOptions.Fields.Item("ID").Value)%>"<%    
        do While NOT RsSelectedCategories.EOF

            If (Not isNull((RsSelectedCategories.Fields.Item("ID").Value))) Then
                If (CStr(RsCategoriesOptions.Fields.Item("ID").Value) = CStr((RsSelectedCategories.Fields.Item("ID").Value))) Then
                    Response.Write(" selected=""selected""")
                    exit do
                end if
            End if        
     
        RsSelectedCategories.MoveNext()
        loop
 %>><%=(RsCategoriesOptions.Fields.Item("Category-label").Value)%></option>
 <%
   RsCategoriesOptions.MoveNext()
Wend
%></select>

Open in new window


I've just found a slight bug, in that if only one item was selected, nothing is displayed.. more than 1 everything is displayed...

Appreciate it if you could have a quick look -

Thank you
0
 
LVL 15

Expert Comment

by:pateljitu
ID: 36931406
Sure glad to help:

1. @garethtnash: I've just found a slight bug, in that if only one item was selected, nothing is displayed. :
  Question: In this case is the <Select> element empty and does not display any items, if that is the case please confirm the resultset from DB for this query
RsRelatedProductOptions_cmd.CommandText = "SELECT ID, [Product-Name] FROM dbo.[Direct-Product] WHERE [Display-TGI-Direct] = 'Y' AND ID <> ? ORDER BY [Product-Name]"

basically recordset RsRelatedProductOptions should return all products available.

and

RsRelated_cmd.CommandText = "Select  R.RelatedProductID as ID from dbo. [Direct-Related-Products] R  where R.ProductID = ?"
0
 

Author Comment

by:garethtnash
ID: 36932476
Thank you
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
This article discusses how to create an extensible mechanism for linked drop downs.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question