www.webdeveloper.com
Results 1 to 6 of 6

Thread: Help

  1. #1
    Join Date
    Mar 2003
    Posts
    432

    Help

    I was wondering if anyone could help me? I have a form that I want to use, I love the layout and all of the functions of it. But I need to know if there is a way to take the information that is put into the form by the user and when the submit butoon is pressed, it copies the information to another page so then the user can confirm the information and print the page and when the submit button pressed agian, then the form is submitted to me. Can anyone help?

    <head>
    <style type="text/css">

    .pane {
    display : none;
    }
    td.tabs {
    border-top : light outset white;
    border-left : light outset white;
    }
    div.tabs {
    background-color : #ffffff;
    cursor : hand;
    }
    </style>
    <!-- following style not necessary -->
    <style type="text/css">
    body {
    background-color : #ffffff;
    }
    input.txt {
    position : absolute;
    left : 120px;
    }
    input.chk {
    position : relative;
    }
    </style>

    <script type="text/javascript">
    var currentPaneStyle = 0;
    var currentTab = 0;

    function tabstrip()
    {
    this.tabs = new Array();
    this.add = addTab;
    this.write = writeTabstrip;
    }

    function tab(caption,content)
    {
    this.setId = setId;
    this.caption = caption;
    this.content = content;
    this.write = writeTab;
    this.writeContent = writePane;
    }



    function addTab(tab)
    {
    tab.setId("tab" + this.tabs.length);
    this.tabs[this.tabs.length] = tab;
    }

    function setId(id)
    {
    this.id = id;
    }

    function initiate()
    {
    var div = document.getElementById("tab0");
    showPane(div);
    }

    function showPane(div)
    {
    if(currentTab != 0)
    {
    currentTab.style.backgroundColor = "#ffffff";
    }
    div.style.backgroundColor = "#ffffff";
    currentTab = div;

    if(currentPaneStyle != 0)
    currentPaneStyle.display = "none";
    var paneId = "pn_" + div.id;
    var objPaneStyle = document.getElementById(paneId).style;
    objPaneStyle.display = "block";
    currentPaneStyle = objPaneStyle;
    }

    function SubmitForm()
    {
    tabform.submit();
    }

    function writePane()
    {
    document.write("<div class='pane' id='pn_" + this.id + "'>" + this.content + "</div>");
    }

    function writeTab()
    {
    document.write("<td class='tabs'><div class='tabs' id='" + this.id + "' onclick='showPane(this)'>" + this.caption + "</div></td>");
    }

    function writeTabstrip()
    {
    document.write("<table class='tabs'><tr>");
    for(var i = 0; i < this.tabs.length; i++)
    {
    this.tabs[i].write();
    }
    document.write("</tr></table>");

    for(var k = 0; k < this.tabs.length; k++)
    {
    this.tabs[k].writeContent();
    }
    initiate();
    }
    </script>
    <script language="JavaScript">
    function fmtPhoneno(fld) {
    var str = fld.value.replace(/[^0-9]/g, "");
    if (!/^[0-9]+$/.test(str)
    || (str.length != 10)) {
    alert("Phone number must\r"+
    "be numeric 10 digits.");
    fld.focus;
    return;
    }
    var x = (str.length<10) ? 0 : 3 ;
    fld.value = (x==0) ? "" : "(" + str.substr(0,3) + ") " ;
    fld.value+= str.substr(x,3) + "-" + str.substr(x+3);
    }
    function chkLimit(fld, nxt, evt) {
    var myKey = (window.Event) ? evt.which : event.keyCode;
    if (myKey < 47 || (myKey > 95 && myKey < 146)) return true;
    // fld.value = fld.value.replace(/[^0-9]/g,""); // this messes up NS4
    // fld.value = fld.value.substr(0,fld.size); // this messes up NS4
    if (fld.value.length == fld.size) {
    window.setTimeout("document."+nxt.form.name+"."+nxt.name+".focus()", 15);
    }
    return true;
    }
    function wrapLimit(fld, nxt, evt) {
    var myKey = (window.Event) ? evt.which : event.keyCode;
    if (myKey != 32 && (myKey < 47 || (myKey > 95 && myKey < 146)))
    return true;
    if (fld.value.length == fld.size) {
    var str = fld.value;
    var pos = str.lastIndexOf(" ");
    if (pos!=(str.length-1) && pos!=(-1)) {
    fld.value = str.substr(0,pos);
    nxt.focus();
    nxt.value = str.substr(pos+1);
    } else {
    window.setTimeout("document."+nxt.form.name+"."+nxt.name+".focus()", 15);
    }
    }
    return true;
    }
    function fieldSizeForNS4() {
    if (typeof document.layers == 'undefined') return true;
    with (document.myForm) {
    ph_area.size = 3;
    ph_prefix.size = 3;
    ph_suffix.size = 4;
    T1.size = 30;
    T2.size = 30;
    T3.size = 30;
    T4.size = 30;
    T5.size = 30;
    }
    return true;
    }
    </script>
    </head>
    <body>
    <script language="Javascript" src="fctrack.js">
    </script>
    <div align="center">
    <pre><b><font size="+7" color="#000000" face="Times New Roman, Times, serif">Fox Valley Newspapers</font><font face="Comic Sans MS" size="+7" color="#000000">
    <font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="#FF0000">To Subscribe to the newspaper(s)
    for your choice please fill out
    the following form.</font></font></b></pre>
    <p>Once all of the contact information is filled out, just click on the newspaper
    choices </p>
    <p>(put a check next to the paper and click when you would like to receive it if applicable, then
    click the billing options</p>
    </div>
    <form name="tabform" method="post" action="cgi-t/form.cgi">
    <p>
    <script type="text/javascript">

    var pane2 = "<table border=10><tr><td>Newspaper Choices:<br><input type='checkbox' name='Business Journal Paper' value='Subscribe Me'>Business Journal</input><br><input type='checkbox' name='Chicago Tribune Paper' value='Subscribe Me'>Chicago Tribune</input><br><input type='checkbox' name='New York Times Paper' value='Subscribe Me'>New York Times</input></td><td rowspan=2>Full Week:<br><input type='radio' name='Business Journal' value=’Full Week’>N/A</input><br><input type='radio' name='Chicago Tribune' value=' Full Week'>$6.00</input><br><input type='radio' name='New York Times' value=' Full Week'>$12.25</input><td <td rowspan=4>Monday - Saturday:<br><input type='radio' name='Business Journal' value='Monday - Saturday'>N/A</input><br><input type='radio' name='Chicago Tribune' value='Monday - Saturday '>$3.50</input><br><input type='radio' name='New York Times' value='Monday - Saturday '>$7.00</input><td rowspan=5>Friday Only:<br><input type='radio' name='Business Journal' value='Friday Only'>$2.50</input><br><input type='radio' name='Chicago Tribune' value='Friday Only '>N/A</input><br><input type='radio' name='New York Times' value='Friday Only '>N/A</input><td rowspan=7>Sunday Only:<br><input type='radio' name='Business Journal' value='Sunday Only'>N/A</input><br><input type='radio' name='Chicago Tribune' value='Sunday Only'>$2.50</input><br><input type='radio' name='New York Times' value='Sunday Only'>$5.50</input><td rowspan=8>Weekend Only:<br><input type='radio' name='Business Journal' value=' Sunday Only'>N/A</input><br><input type='radio' name='Chicago Tribune' value='Sunday Only'>$3.25</input><br><input type='radio' name='New York Times' value='Sunday Only'>$6.75</input></td></tr></table>";

    var pane1 = "First Name: <input type='text' class='txt' name='First Name' size=20></input><br><br>Last Name: <input type='text' class='txt' name='Last Name' size=20></input><br><br>Address: <input type='text' class='txt' name='Address' size=20></input><br><br>Apartment: <input type='text' class='txt' name='Apartment' size=20></input><br><br>City: <input type='text' class='txt' name='City' size=20></input><br><br>State: <input type='text' class='txt' name='State' value='Wisconsin' onFocus='this.blur()' size=20></input><br><br>ZIP:<input type='text' class='txt' name='Zip'size=20></input><br><br>E-Mail:<input type='text' class='txt' name='E-Mail' size=20></input><br><br>Home Phone: <input type='text' class='txt' name='Work Phone' size=20 onChange=fmtPhoneno(this);></input><br><br>Work Phone: <input type='text' class='txt' name='Work Phone' size=20 onChange=fmtPhoneno(this);></input>";

    var pane3 = "<table border=0><tr><td>Bill Me For:<br><input type='radio' name='Bill Me For' value='1 Month'>1 Month</input><br><input type='radio' name='Bill Me For' value='3 Months'>3 Months</input><br><input type='radio' name='Bill Me For' value='6 Months'>6 Months</input></td>";

    var pane4 = "<table border=0><tr><td></td>";

    var ts = new tabstrip();
    var t1 = new tab("Contact Information",pane1);
    var t2 = new tab("Newspaper Choices",pane2);
    var t3 = new tab("Billing Options",pane3);
    var t4 = new tab("",pane4);

    ts.add(t1);
    ts.add(t2);
    ts.add(t3);
    ts.add(t4);
    ts.write();
    </script>
    <input type=hidden name="to" value=" subscribe@foxvalleynews.com">
    <input type=hidden name="redirect" value="http://foxvalleynews.com/thank you for your subscription.html">
    <input type=hidden name="subject" value="Milwaukee Area Subscription">
    <input type=HIDDEN name=from value="subscribe@foxvalleynews.com">
    <input type=hidden name="required" value="First Name,Last Name,Address,City,Zip,E-Mail,Bill Me For">
    <input type=hidden name="print_blank_fields" value="1">
    </p>
    </form>
    <button onclick="SubmitForm()">Subscribe Me Now</button>
    <form name="form1" method="post" action="">
    </form>
    <p> </p>
    <img src="http://www.foxvalleynews.com/cgi-t/counter?df=foxvalleynews.com.MilwaukeeArea&sh=0">
    </body>

    P.S. I do not have another page made up for the transfering of information, becasue I did not know if what I asked was possible.

    Thanks

  2. #2
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104
    Here's some code to get you going. Set you forms action to 'verify.php' and the form's method to 'post'.

    verify.php
    PHP Code:
    <html>
    <head>
    <title>Please verify your information</title>
    </head>
    <body>
    <?PHP

    #######################################################
    # This script is Copyright 2003, Infinity Web Design  #
    # Written by Ryan Brill - [email]ryan@infinitypages.com[/email]      #
    # All Rights Reserved - Do not remove this notice     #
    #######################################################


    echo "Please verify that the following information is correct:<br/><br/>";
    foreach (
    $_POST as $key => $value) {
        
    $msg .= ucfirst ($key) ." : "$value "<br/>";
    }
    foreach (
    $_POST as $key => $value) {
        
    $emsg .= ucfirst ($key) ." : "$value "\n";
    }
    echo 
    $msg;
    ?>
    <form action="mailer.php" method="post">
    <input type="hidden" name="formvalues" value="<?PHP echo $emsg?>" />
    <input type="submit" value="Yes" /> the information is correct.<br/>
    <input type="button" value="No" onclick="history.go(-1)"/> the information is incorrect. <br/>
    </form>

    </body>
    </html>
    mailer.php
    PHP Code:
    <?PHP

    #######################################################
    # This script is Copyright 2003, Infinity Web Design  #
    # Written by Ryan Brill - [email]ryan@infinitypages.com[/email]      #
    # All Rights Reserved - Do not remove this notice     #
    #######################################################

    ## The lines below need to be edited...

    ###################### Set up the following variables ######################
    #                                                                          #
    $to "you@your.com"#set address to send form to
    $subject "Results from your Request Info form"#set the subject line
    $headers "From: Form Mailer"#set the from address
    $forward 0# redirect? 1 : yes || 0 : no
    $location "thankyou.htm"#set page to redirect to, if 1 is above
    #                                                                          #
    ##################### No need to edit below this line ######################

    ## set up the time ##

    $date date ("l, F jS, Y");
    $time date ("h:i A");

    ## mail the message ##

    $msg "Below is the result of your feedback form.  It was submitted  on $date at $time.\n\n";
            
    $msg .= $_POST['formvalues'];

    mail($to$subject$msg$headers);
    if (
    $forward == 1) {
        
    header ("Location:$location");
    }
    else {
        echo (
    "Thank you for submitting our form. We will get back to you as soon as possible.");
    }

    ?>

    Personal website http://www.ryanbrill.com/
    Business website: http://www.infinitywebdesign.com/
    TypeSpace http://www.typespace.org/

    I reject your reality and substitute it with my own!

  3. #3
    Join Date
    Mar 2003
    Posts
    432
    Pyro~
    Thank you for your help The only one thing that I still need help on is, what code can I put in my form that make text boxes required and does not show up on the varify.php? Thank you again for your help
    Taz

  4. #4
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104
    Could you explain what you need more clearly, please?

    Personal website http://www.ryanbrill.com/
    Business website: http://www.infinitywebdesign.com/
    TypeSpace http://www.typespace.org/

    I reject your reality and substitute it with my own!

  5. #5
    Join Date
    Mar 2003
    Posts
    432
    ok here is the JS code but it shows up in the varify.php, I do not want it to show up in the php. Can you help thanks

    <input type=hidden name="required" value="First Name,Last Name,Address,City,Zip,E-Mail,Bill Me For">

  6. #6
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104
    Change the first foreach loop to this:

    PHP Code:
    foreach ($_POST as $key => $value) {
        if (
    $key != "required") {
            
    $msg .= ucfirst ($key) ." : "$value "<br/>";
        }


    Personal website http://www.ryanbrill.com/
    Business website: http://www.infinitywebdesign.com/
    TypeSpace http://www.typespace.org/

    I reject your reality and substitute it with my own!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles