...

View Full Version : Maddening Form Problem



Jearb
06-11-2010, 10:33 PM
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.


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>";

mbaker
06-13-2010, 12:26 AM
I have created three files and can not see what the problem is:

frame-problem.html:

<!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:

<!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:

<!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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum