php - Text Input in HTML Form won't show up -
i working on text-based online game (that horribly incomplete), , i'm using php mainly. in html have form (text input) commands game, won't show up. html:
<div class="container"> <div class="main"> <?php include_once 'game.php'; ?> </div> <form name="form1" method="post" action=""> <input type="text" value="" name="input" style="width: 600; position: absolute; bottom: 0; z-index: 2;"> </input> </form> <?php $input = $_post["input"]; ?> </div>
so it's form , input screws me on since doesn't show up. have css, if helps:
.main { width: 600px; height: 400px; background-color: white; border: 1px solid black; position: absolute; top:0; left: 0; right: 0; z-index: 1; } .container { width: 602px; height: 500px; background-color: white; border: 1px solid blue; position: absolute; top: 0; bottom: 0; left: 0; right: 0; z-index: 0; margin: 0 auto; }
and of course have game.php
don't feel that's problem.
any appreciated.
edit: based on people's answers, it's php. here's entire code game.php file, have no idea what's wrong.
<?php include_once 'index.php'; $world = simplexml_load_file("gameworld.xml"); $currentpos = 0; $done = 0; print "<br>"; printplace(); function printplace() { global $world, $currentpos; $room = $world->room[$currentpos]; $name = $room->name; $desc = wordwrap((string)$room->desc); print "$name<br>"; print str_repeat('-', strlen($name)); print "<br>$desc<br>"; if ((string)$room->north != '-') { $index = (int)$room->north; print "north: {$world->room[$index]->name}<br>"; } if ((string)$room->south != '-') { $index = (int)$room->south; print "south: {$world->room[$index]->name}<br>"; } if ((string)$world->room[$currentpos]->west != '-') { $index = (int)$room->west; print "west: {$world->room[$index]->name}<br>"; } if ((string)$world->room[$currentpos]->east != '-') { $index = (int)$room->east; print "east: {$world->room[$index]->name}<br>"; } print "<br>"; } while (!$done) { print "<br>"; // add line break after user input $input = split(' ', $input); switch(trim($input[0])) { case 'north': if ((string)$world->room[$currentpos]->north != '-') { $currentpos = (int)$world->room[$currentpos]->north; printplace() ; } else { print "you cannot go north!<br>"; } break; case 'south': if ((string)$world->room[$currentpos]->south != '-') { $currentpos = (int)$world->room[$currentpos]->south; printplace() ; } else { print "you cannot go south!<br>"; } break; case 'west': if ((string)$world->room[$currentpos]->west != '-') { $currentpos = (int)$world->room[$currentpos]->west; printplace() ; } else { print "you cannot go west!<br>"; } break; case 'east': if ((string)$world->room[$currentpos]->east != '-') { $currentpos = (int)$world->room[$currentpos]->east; printplace() ; } else { print "you cannot go east!<br>"; } break; case 'look': printplace() ; break; case 'quit': $done = 1; break; } } print "<br>thanks playing!<br>"; ?>
really, it's branch off of http://www.hackingwithphp.com/21/4/2/text-game-v1 tried port browsers failed horribly...
it shows fine in chrome , in firefox. see below.
.main { width: 600px; height: 400px; background-color: white; border: 1px solid black; position: absolute; top: 0; left: 0; right: 0; z-index: 1; } .container { width: 602px; height: 500px; background-color: white; border: 1px solid blue; position: absolute; top: 0; bottom: 0; left: 0; right: 0; z-index: 0; margin: 0 auto; }
<div class="container"> <div class="main"> </div> <form name="form1" method="post" action=""> <input type="text" value="" name="input" style="width: 600; position: absolute; bottom: 0; z-index: 2;"> </input> </form> </div>
Comments
Post a Comment