www.webdeveloper.com
Results 1 to 8 of 8

Thread: Submit Button

Hybrid View

  1. #1
    Join Date
    Oct 2012
    Posts
    36

    Submit Button

    I created the following code, but I need help on when clicking the submit button to have it open in a new window or tab with the submitted information and i'm having some troubles.

    Can someone please help guide me


    HTML Code:
    <head>
    </head>
    <style>
     .labelclass{
      float: left;
      width: 113px;
     }
    </style>
    <h1>Notes For The Month Of August</h1>
    <body>
    <form name="myform"/>
    <span class="labelclass">Customer Name: </span><input type="text" name="name"<br>
    <span class="labelclass">Phone Number: </span><input type="text" name="pnumber"<br>
    <span class="labelclass">E-Mail Address: </span><input type="text" name="eaddy"<br>
    <span class="labelclass">Issue: </span><input type="text" name="issue"<br>
    <span class="labelclass">Results: </span><input type="text" name="results"<br>
    <span class="labelclass">Date: </span><input type="date" name="Date"<br>
    <input type="submit" value="submit"/>
    </form>
    </body>
    </html>

  2. #2
    Join Date
    Mar 2011
    Posts
    1,137
    You can have the <form> open in a new window or tab by setting the 'target' attribute on the <form> tag:
    Code:
    <form name="myform" action="???" target="_new">
    The 'target' attribute is technically depreciated, so its use is probably discouraged, but it is supported by browsers and will likely remain supported for the foreseeable future. Whether the browser opens a new window or a new tab depends on the user's preferences. You need to set the 'action' attribute on the <form> tag, or the browser will default to the current page/document.

    You also need to clean up your HTML, especially those unclosed <input> tags.
    Rick Trethewey
    Rainbo Design

  3. #3
    Join Date
    Oct 2012
    Posts
    36
    I've been doing some cleaning and this is what i have so far

    HTML Code:
    <title>Untitled Document</title>
    <style type="text/css">
     .labelclass{
      float: left;
      width: 113px;
     }
    </style>
    </head>
    <body>
    <center>
    <h1>Notes For The Month Of August</h1>
    </center>
    <form name="myform" action="file:///C|/xampp/htdocs/results.php" target="_blank" method="post" /><span class="labelclass">Customer Name: </span><input type="text" name="name" /><br />
    <span class="labelclass">Phone Number: </span><input type="text" name="pnumber" /><br />
    <span class="labelclass">E-Mail Address: </span><input type="text" name="eaddy" /><br />
    <span class="labelclass">Issue: </span><input type="text" name="issue" /><br />
    <span class="labelclass">Results: </span><input type="text" name="results" /><br />
    <span class="labelclass">Date: </span><input type="date" name="fixed" /><br />
    <input type="submit" value="submit"/>
    </body>
    I was also told by someone else that i had to create a .php file and i did that as well

    PHP Code:
    <title>Untitled Document</title>

    </head>

    <body>
    <?php
    if($_POST["submit"]))
    {
        
    $customername $_POST["name"];
        
    $phonenumber $_POST["pnumber"];
        
    $email $_POST["eaddy"];
        
    $issue $_POST["issue"];
        
    $result $_POST["results"];
        
    $date $_POST["Date"];
        
        
        echo 
    "Customer Name: $customername<br />
        Phone Number: 
    $phonenumber<br />
        E-Mail Address: 
    $email<br />
        Issue: 
    $issue<br />
        Results: 
    $result<br />
        Date: 
    $date<br />"

    ?>
    </body>
    </html>
    However though when I go to click on submit below is the end result.

    Phone Number: $phonenumber
    E-Mail Address: $email
    Issue: $issue
    Results: $result
    Date: $date
    " } ?>

    And as you can see the Customer Name field is not showing up. and at this point i'm so lost

  4. #4
    Join Date
    Mar 2011
    Posts
    1,137
    Try:
    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <title>Untitled Document</title>
    <style type="text/css">
     .labelclass{
      float: left;
      width: 113px;
     }
    </style>
    </head>
    <body>
    <center>
    <h1>Notes For The Month Of August</h1>
    </center>
    <form name="myform" action="file:///C|/xampp/htdocs/results.php" target="_blank" method="post">
    <span class="labelclass">Customer Name: </span><input type="text" name="name" /><br />
    <span class="labelclass">Phone Number: </span><input type="text" name="pnumber" /><br />
    <span class="labelclass">E-Mail Address: </span><input type="text" name="eaddy" /><br />
    <span class="labelclass">Issue: </span><input type="text" name="issue" /><br />
    <span class="labelclass">Results: </span><input type="text" name="results" /><br />
    <span class="labelclass">Date: </span><input type="date" name="Date" /><br />
    <input type="submit" value="submit"/>
    </body>
    </html>
    You had a stray '/' in your <form> tag that could have been confusing your browser. You also had a mismatch in the 'name' attribute in the 'date' <input> tag.
    Rick Trethewey
    Rainbo Design

  5. #5
    Join Date
    Oct 2012
    Posts
    36
    if i can provide you with any further information about programs or anything let me know,

  6. #6
    Join Date
    Oct 2012
    Posts
    36
    Still coming to these results when i press submit

    Phone Number: $phonenumber
    E-Mail Address: $email
    Issue: $issue
    Results: $result
    Date: $date
    " } ?>

  7. #7
    Join Date
    Aug 2013
    Posts
    6
    Hi!
    just put name="submit" in your submit button.
    <input type="submit" name="submit" value="submit">
    Hope it'll solve your issue.
    Thanks

  8. #8
    Join Date
    Oct 2012
    Posts
    36
    the submit button is working however its just now when i click on submit being that i have the php file associated the resutls are coming as followed

    Phone Number: $phonenumber
    E-Mail Address: $email
    Issue: $issue
    Results: $result
    Date: $date
    " } ?>

    i'm not sure if i need to move this into php discussion group or not

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