SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Aug 2005
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Making the submit button a hyperlink?

    Hi,

    Could someone explain to me in step by step idiot terms how I go about writing a form that transfers the viewer to a new page when they click submit.
    The actual posting of information from my form work perfectly, it just seems to have not worked from the viewers perspective becouse nothing seems to happen.

    I've asked this on a couple of forums but I've only ever used basic HTML and nobody seems willing to walk me through it

    Thanks in advance (I hope)

    PS

    I've opened my form
    <form method="post" action="(my website)" action="http://www.labyrinthcorsets.co.uk">
    And my button is
    <input type="submit" value="Place Your Order">

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,290
    Mentioned
    198 Post(s)
    Tagged
    3 Thread(s)

    submit button redirect

    Quote Originally Posted by Amatheya
    ... walk me through it ...
    A form's submit button does one thing, it submits the form's data. If you want to do 2 things (or more) you can use an input button that has the value "submit", so it will look the same to users. Then you can either assign an event handler to it (more OOP like) or have it call a function. I have too many years experience with procedural coding to easily think in OOP-think, and am only with difficulty beginning to grasp it.
    Write a new form, and some javascript code to change the desired objects' properties and your on your way. (hint: in this case document.formName.submit and window.location.href) Post what you come up with and we can go from there, although really that's just about it, and you probably can figure it out on your own now.

  3. #3
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    HTML Code:
    <head>
      ...
      <style type="text/css">
        #place-order {
          background: transparent;
          color: #00f;
          border: none;
          text-decoration: underline;
        }
      </style>
    </head>
    <body>
      <form action="thenewpage.php" method="post">
        ...
        <input id="place-order" type="submit" value="Place your order">
      </form>
      ...
    </body>
    Birnam wood is come to Dunsinane


Bookmarks

Posting Permissions

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