MasterACE14 Posted September 16, 2007 Share Posted September 16, 2007 How can I make a form like the following?: <form method="post" action="commentpage.php"> <textarea rows="5" cols="20" wrap="physical" name="comments"> Enter Comments Here </textarea> <input type="submit" value="submit"> </form> <?php echo "$_POST['comments'] was your comment"; ?> I just want to have a form that does everything on one page, instead of being sent to another page with "action="anotherpage.php"" Regards ACE Quote Link to comment Share on other sites More sharing options...
rarebit Posted September 16, 2007 Share Posted September 16, 2007 Then put the code at the top of page: if(isset(POST) { // Handle // Display } else { // Show form } Quote Link to comment Share on other sites More sharing options...
MasterACE14 Posted September 16, 2007 Author Share Posted September 16, 2007 I'm having no luck here, Basically, the form is used to search for elements or values in a 2 dimensional array. And then echo it if it has found it. heres the code: <?php // encyclopedia /* includes */ include '/home/ace/public_html/conflictingforces/weapons.php'; ?> <div id = "encyclopedia"> <center><b><u>Encyclopedia - Beta</u></b><br></center><br> <fieldset><legend>Search</legend> <?php if(isset($_POST)) { // Handle // Display echo 'Item is '.array_search($_POST["item"],$weapons); } else { // Show form ?> <form method="post" action="index.php?page=encyclopedia"> item: <input type="text" size="15" maxlength="60" name="item"> <input type="submit" value="Search"> </form> <?php } ?> </fieldset> <br> <center> <center> <?php /* Grab weapon Array and Display it */ for ($row = 0; $row < 3; $row++) { echo "<table class=\"fix\">"; echo "<tr><td colspan='2'>WEAPON</td></tr>"; foreach($weapons[$row] as $key => $value) { echo "<tr>"; echo "<td>".$key."</td>"; echo "<td>".$value."</td>"; echo "</tr>"; } } echo "</table>"; ?> </center> </center> </div> Regards ACE Quote Link to comment Share on other sites More sharing options...
MasterACE14 Posted September 16, 2007 Author Share Posted September 16, 2007 anyone have any ideas? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.