SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    SitePoint Guru adammc's Avatar
    Join Date
    Aug 2004
    Location
    Cairns, Australia
    Posts
    762
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Input / submit button not working

    HI guys,

    Can anyone possibly expain why the following button is just sitting there and wont goto the url?

    PHP Code:
    <form action=\"http://www.google.com/index.php\" method=\"get\" 
    target=\"_self\"><input type=\"submit\" value=\"Continue Shopping\"></form> 
    It does however work if I leave this existing code in; you can then click the bottom button to get to the url:

    PHP Code:
     <form action='http://www.google.com/index.php' method='post' id='continueshopping'>
                <
    input type='submit' VALUE='Continue Shopping'>
                
                </
    form>
                
                <
    form action=\"http://www.google.com/index.php\" method=\"get\" 
    target=\"_self\"><input type=\"submit\" value=\"Continue Shopping\"></form> 

  2. #2
    SitePoint Addict joaquin_win's Avatar
    Join Date
    Jul 2005
    Location
    Venezuela
    Posts
    224
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why are the quotes escaped? (\") You should not escape those quotes.

    Also, the first quote for the 'action' attribute of the form tag is not escaped, so that could be part of the problem.

  3. #3
    SitePoint Guru adammc's Avatar
    Join Date
    Aug 2004
    Location
    Cairns, Australia
    Posts
    762
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for the reply.
    I am escaping the quotes because the code is within a php script.

    I fixed the action attribute like you suggested but it still wont do anything??

    PHP Code:
     <form action=\"http://www.google.com/index.php\" method=\"get\" target=\"_self\">
                           <input type=\"submit\" value=\"Continue Shopping\">
                       </form> 

  4. #4
    SitePoint Guru adammc's Avatar
    Join Date
    Aug 2004
    Location
    Cairns, Australia
    Posts
    762
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, I Got it sorted using:
    PHP Code:
       <FORM>
    <
    INPUT TYPE='BUTTON' VALUE='Continue Shopping' ONCLICK=\"window.location.href='http://www.domain.com/store/'\">
    </FORM> 

  5. #5
    SitePoint Addict joaquin_win's Avatar
    Join Date
    Jul 2005
    Location
    Venezuela
    Posts
    224
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also, you are missing the closing of the input tag:

    <input .... />

    Maybe it's that? What's the output you see on the browser (view source code)

  6. #6
    SitePoint Evangelist Karpie's Avatar
    Join Date
    Jul 2007
    Location
    Perth, Australia
    Posts
    445
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You haven't fixed the action attribute... you're still escaping every double quote after the first one. What's the PHP line you're using to output that form tag?

    Your 'sorted' method is still escaping what it shouldn't...

  7. #7
    SitePoint Guru adammc's Avatar
    Join Date
    Aug 2004
    Location
    Cairns, Australia
    Posts
    762
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK...now I am really stumped LOL
    The update button below works in Firefox but in IE the button wont press???

    PHP Code:
    <td width=\"33%\" align=\"center\" scope=\"col\" valign=\"center\">

        <form name=\"continue\">
            <input type=\"button\" value=\"Continue Shopping\" onclick=\"window.location.href='http://www.aaaaa.com.au/store/'\" />
        </form>

    </td>
                       
    <td width=\"33%\" align=\"center\" scope=\"col\" valign=\"center\">
        <input type=\"submit\" value=\"Update Cart\" /></form>
      </td> 
    If I remove the first td cell and contents the update cart button works in both IE and firefox.

    Can anyone possibly assist?

  8. #8
    SitePoint Guru adammc's Avatar
    Join Date
    Aug 2004
    Location
    Cairns, Australia
    Posts
    762
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Karpie View Post
    What's the PHP line you're using to output that form tag?
    PHP Code:
    $output[] = "form code here";
    $output[] = "form code here";

    return 
    join('',$output); 

  9. #9
    SitePoint Wizard silver trophybronze trophy
    Join Date
    Jul 2008
    Location
    New York, NY
    Posts
    1,432
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by joaquin_win View Post
    Also, you are missing the closing of the input tag:

    <input .... />

    Maybe it's that? What's the output you see on the browser (view source code)
    http://www.w3.org/TR/html401/interact/forms.html

    What if he is using html 4.01?

  10. #10
    SitePoint Guru adammc's Avatar
    Join Date
    Aug 2004
    Location
    Cairns, Australia
    Posts
    762
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cooper.semantics View Post
    What if he is using html 4.01?
    I am using XHTML 1.0 Strict

  11. #11
    SitePoint Evangelist Karpie's Avatar
    Join Date
    Jul 2007
    Location
    Perth, Australia
    Posts
    445
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK. Look at the code. The syntax colouring straight away should tell you there's a problem - you're opening the first string for the table cell with a double quote, but escaping all the closing double quotes (\" instead of "), so that it never actually gets closed. I'm surprised it works anywhere.

    And thank you for not posting the actual code like I asked -_-

  12. #12
    SitePoint Addict joaquin_win's Avatar
    Join Date
    Jul 2005
    Location
    Venezuela
    Posts
    224
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What's the actual output? from the view page source in the browser?

  13. #13
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,622
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Instead of using double quotes and escaping them wiith the backslash, just use single quotes...
    Always looking for web design/development work.
    http://www.CodeFundamentals.com


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
  •