Hi,
I'm a bit new to php and am hoping that someone would be kind enough to help me with my problem. What I want to achieve is as follows: I created a form in my .php file, once I click the add button I want another form to appear on the same page but overwrite/delete the previous form. Here is what I need help with:
How can I output another form (on the same .php page) and overwrite/delete the previous form using php "without having to create another .php file"?
Here is my forms.php code:
<html>
<head>
<link rel="stylesheet" type="text/css" href="forms.css" />
<title>about forms</title>
</head>
<body>
<form action="" method="post" id="form1">
<div id="container">
<div id="header">About Forms</div>
<div id="name">Name</div>
<div id="nametext">
<input type="text" name="nameEntry" size="30"></div>
<div id="item"><br>Item Type</div>
<div id="itemchoice">
<input type="radio" name="itemtype" value="Book" checked>
<b>Book</b><br>
<input type="radio" name="itemtype" value="Author">
<b>Author</b><br>
<input type="radio" name="itemtype" value="Publisher">
<b>Publisher</b>
</div>
<div id="book"><b>Book Type</b> <font size="1px">(if applicable)</font></div>
<div id="bookchoice"><select name="booktype">
<option value="Horror" selected><b>Horror</b>
<option value="Suspense"><b>Suspense</b>
<option value="Romance"><b>Romance</b>
</select>
</div>
<div id="displaydebug">Display Debug</div>
<div id="checkdebug">
<input type="checkbox" name="debug">
<font size="1px">Check if you want to display</font></div>
<div id="buttons"><input type="submit" name="search" value="Search">
<input type="submit" name="add" value="Add">
</div>
</div>
<div id="footer">Designed and Developed by me, Copyright 2011</div>
</form>
<?php
if (isset($_POST["add"])) {
echo '<pre>';
echo (print_r($_POST));
echo '</pre>';
}
if (isset($_POST["search"])) {
echo "Search button has not yet been implemented.";
}
?>
</body>
</html>
Any help and suggestions would be appreciated. Thanks! =)