Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2008
    Posts
    47
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Maddening Form Problem

    I've been working on this little piece of code for much too long now. I've done something like it before, and before I was able to attribute it to some stupid error and was able to fix it. But I forgot what that error was.

    Basically, it's a form in a frame that sends the result to the frame next to it. It's being outputted by this massive PHP block, causing the "echo;" makeup. Please help me - I don't want to be stuck on this any longer, else I may go insane.

    PHP Code:
    echo "Play your flute <form action=\"fightPane.php\" method=\"get\" target='fightpane'> 
            <select name='amount'>
            <option value='1'>not very (" 
    $bard1 " MP)</option>
            <option value='2'>sorta (" 
    $bard1*" MP)</option>
            <option value='3'>pretty (" 
    $bard1*" MP)</option>
            <option value='4'>really (" 
    $bard1*" MP)</option>
            </select>
            <input type='hidden' name='action' value='bard' />
            <input type='hidden' name='kind' value='flute' />
        <input type='submit' value='hard.' class=\"lol1\" onmouseover=\"this.className='lol2'\" onmouseout=\"this.className='lol1'\" />
    </form>"


  • #2
    Regular Coder mbaker's Avatar
    Join Date
    Jan 2010
    Location
    Burford, Oxfordshire, United Kingdom
    Posts
    249
    Thanks
    1
    Thanked 39 Times in 39 Posts
    I have created three files and can not see what the problem is:

    frame-problem.html:
    Code:
    <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Frameset//EN'
    'http://www.w3.org/TR/html4/frameset.dtd'>
    <html><head>
    <title>Frame Problem</title></head>
    
    <frameset cols='50%,50%'>
    <frame src='20100612-form-problem.php'>
    <frame src='fightPane.php' name='fightpane'>
    
    <noframes>
    In a browser that supports Frames this page shows:
    a <a href='20100612-form-problem.php'>form problem</a>, and
    <a href='fightPane.php'>fight pane</a>.
    </noframes>
    
    </frameset>
    
    </html>
    20100612-form-problem.php:
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
    "http://www.w3.org/TR/html4/loose.dtd">
    <html lang='en'>
    <head>
    <meta http-equiv='Content-type' content='text/html;charset=UTF-8'>
    <title>Form Problem</title>
    <style type="text/css">
    .lol1 { background: red; }
    .lol2 { background: lime; }
    </style>
    </head>
    <body>
    <h1>Form Problem</h1>
    <?php
    $bard1 = 10;
    echo "Play your flute <form action=\"fightPane.php\" method=\"get\" target='fightpane'>  
            <select name='amount'> 
            <option value='1'>not very (" . $bard1 . " MP)</option> 
            <option value='2'>sorta (" . $bard1*2 . " MP)</option> 
            <option value='3'>pretty (" . $bard1*3 . " MP)</option> 
            <option value='4'>really (" . $bard1*4 . " MP)</option> 
            </select> 
            <input type='hidden' name='action' value='bard' /> 
            <input type='hidden' name='kind' value='flute' /> 
        <input type='submit' value='hard.' class=\"lol1\" onmouseover=\"this.className='lol2'\" onmouseout=\"this.className='lol1'\" /> 
    </form>";
    ?>
    </body>
    </html>
    fightPane.php:
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
    "http://www.w3.org/TR/html4/loose.dtd">
    <html lang='en'>
    <head>
    <meta http-equiv='Content-type' content='text/html;charset=UTF-8'>
    <title>Fight Pane</title>
    </head>
    <body>
    <h1>Fight Pane</h1>
    <p>The values passed to fightPane.php are:</p>
    <ul>
    <?php
    foreach ( $_GET as $key => $value ) {
      echo "<li>\$key = " . $key . ", \$value = ". $value . "</li>";
    }
    ?>
    </ul>
    </body>
    </html>
    Please describe your problem. If necessary modify the above so that the three files illustrate the problem you are having.
    Last edited by mbaker; 06-12-2010 at 11:27 PM. Reason: correcting typo
    - Michael Baker - HTML Tags Guide - Reference and Tutorials
    - Like voting, validate early, validate often - W3C HTML Validator - W3C CSS Validator
    - Wot? me cynical? no, its just if you vote, er, validate early, you have more chance of validating often.


  •  

    Posting Permissions

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