Solved

Contact page with acknowledgement page

Posted on 2013-11-11
7
216 Views
Last Modified: 2013-11-24
I have been trying to figure out how to get my contact page once filled out to show an acknowledgement page that has the users input information ( first name, last name, email, number, and comment made) along with a message.
0
Comment
Question by:redrose43311
  • 3
  • 2
  • 2
7 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39640108
A contact form page needs to be submitted to a page that is programmed in a server side language like PHP or ASP to receive it and do something with it.  What language are you using on your web server?
0
 

Author Comment

by:redrose43311
ID: 39640150
It is to be written in ASP, I have been using Dreamweaver to write the codes for the contact form. I am new to all of this so kinda confused.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39640400
This page shows you the basics: http://www.w3schools.com/asp/asp_inputforms.asp
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 32

Expert Comment

by:Big Monty
ID: 39641663
show us what you've gotten so far with coding and ask specific questions on what you're having problems and I'm absolutely positive someone on here will help you out.

you may also want to consider adding the ASP zone
0
 

Author Comment

by:redrose43311
ID: 39643420
Ok I am so lost here, Now for some reason I can not get the information to validate nor load to a new page with the users input information showing. here is the code I am working with,


<%@LANGUAGE="JAVASCRIPT" 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>contactform</title>
</head>

<body>
<form action="" method="post">
  <table width="481" border="2">
    <tr>
      <th width="183" scope="row">First name</th>
      <td width="280"><input type="text" name="fname" id="fname" /></td>
    </tr>
    <tr>
      <th scope="row"><label for="lname">Last Name</label></th>
      <td><input type="text" name="lname" id="lname" /></td>
    </tr>
    <tr>
      <th scope="row"><label for="email">Email Address</label></th>
      <td><input type="text" name="email" id="email" /></td>
    </tr>
    <tr>
      <th scope="row"><label for="pnumber">Phone Number</label></th>
      <td><input type="text" name="pnumber" id="pnumber" /></td>
    </tr>
    <tr>
      <th scope="row">Reason for Contact</th>
      <td><textarea name="comment" id="comment"></textarea></td>
    </tr>
    <tr>
      <th height="56" scope="row">&nbsp;</th>
      <td><input type="submit" name="button" id="button" value="Submit" /></td>
    </tr>
  </table>
</form>
</body>
</html>
0
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 250 total points
ID: 39643498
This line <%@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%> is not needed for the code that you have.  There is no javascript on that page.

And this line <form action="" method="post"> tells the form to POST to itself.  To POST it to another page, you have put that page in the 'action' attribute like...
<form action="nextpage.asp" method="post">

Open in new window

Please read the page I linked... http://www.w3schools.com/asp/asp_inputforms.asp
0
 
LVL 32

Accepted Solution

by:
Big Monty earned 250 total points
ID: 39644950
i don't see any validation code, no wonder its not validating :)

you should be able to use the code below to validate all of the fields and make sure they're filled out. This uses straight-forward javascript (this seems like a learning exercise and I don't want to throw too much at you. just a FYI, using jQuery to validate would be easier as would HTML5). This form posts itself and when it does, it'll write out the data posted to the screen. you'll notice I changed the server side language to vbscript, typically server side coding is done in vbscript, and client side is done in javascript. It's not a hard and fast rule, you can code in either, but the industry standard is typically done this way.

<%@language=vbscript %>

<%
if Request.Form("button") = "Submit" then    '-- submit button was pressed
     Response.Write Your data looks like this:<br/><br/>" _
               "First Name: " & Request.Form("fname") & "<br/><br/>" _
               "Last Name: " & Request.Form("lname") & "<br/><br/>" _
               "Email:" & Request.Form("email") & "<br/><br/>" _
               "Phone Number" & Request.Form("pnumber") & "<br/><br/>" _
               "Comments:<br>" & Request.Form("comment")
end if
%>
<!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>contactform</title>

<script  type="text/javascript">
     function validateForm() {
         var frm = document.form;  //-- gets the form object and assigns it to a local variable
         var validate = true;   // we check this variable at the end, if it's true, we submit
         var msg = '';

          if( frm.fname == '' ) {
             msg = 'Please fill out your first name.';
             validate = false;
             frm.fname.focus();     //-- set the focus to the invalid field
         } else if( frm.lname == '' ) {
             msg = 'Please fill out your last name.';
             validate = false;
             frm.lname.focus();     //-- set the focus to the invalid field
         } else if( frm.email == '' ) {
             msg = 'Please fill out your email address.';
             validate = false;
             frm.email.focus();     //-- set the focus to the invalid field
         } else if( frm.pnumber == '' ) {
             msg = 'Please fill out your phone number.';
             validate = false;
             frm.pnumber.focus();     //-- set the focus to the invalid field
         } else if( frm.comment == '' ) {
             msg = 'Please fill out the comments field.';
             validate = false;
             frm.comment.focus();     //-- set the focus to the invalid field
         } 

         if( ! validate )
            alert( msg );

         return validate;     // if this is false the form will not submit
     }
</script>
</head>

<body onsubmit="return validateForm();">
<form action="samepage.asp" method="post">
  <table width="481" border="2">
    <tr>
      <th width="183" scope="row">First name</th>
      <td width="280"><input type="text" name="fname" id="fname" /></td>
    </tr>
    <tr>
      <th scope="row"><label for="lname">Last Name</label></th>
      <td><input type="text" name="lname" id="lname" /></td>
    </tr>
    <tr>
      <th scope="row"><label for="email">Email Address</label></th>
      <td><input type="text" name="email" id="email" /></td>
    </tr>
    <tr>
      <th scope="row"><label for="pnumber">Phone Number</label></th>
      <td><input type="text" name="pnumber" id="pnumber" /></td>
    </tr>
    <tr>
      <th scope="row">Reason for Contact</th>
      <td><textarea name="comment" id="comment"></textarea></td>
    </tr>
    <tr>
      <th height="56" scope="row">&nbsp;</th>
      <td><input type="submit" name="button" id="button" value="Submit" /></td>
    </tr>
  </table>
</form>
</body>
</html>

Open in new window


be sure to set the forms action to the name of the page in order for it to work. You can also put your confirmation page name there and use the same logic I used, except writing it to a screen, you'll probably want to save it to the database.

Hope this helps get you in the right direction
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now