I am kind of new to PHP, learning through books and online resources but I am having difficulties with what seems like an easy problem.

if($pageid == 1){
		echo "";	
		} else {
		echo '<form action="delete_ad.php" method="post">';
		echo '<input name="deleteid" type="text" value="" id="deleteid"  hspace="10"/>';
		echo '<input name="delete" type="submit" value="Delete Ad" id="deletebtn"/>';
		echo '<br /><br />';
		echo '<table id="emailform" class="signup">
		<th colspan="2" align="center">Email Form</th>
		<form method="post" action="send.php">
		<tr><td>Name</td><td><input type="text" maxlength="32"
		name="name" /></td>
		</tr><tr><td>Email</td><td><input type="text" maxlength="32"
		name="senderemail" /></td>
		</tr><tr><td>Message</td><td><textarea name="message"></textarea></td>
		</tr><tr><td colspan="2" align="center">
		<input type="submit" value="Send" /></td>

The green part works, while the form in the red part does not want to work, when ever I click on Send it brings me back to the homepage instead of going to send.php. I know its better to use html and then send it to php, and when I do that everything works fine, but in this particular case I need it to be echoed. I tried to put the html in a mysql table and echo it, but that did not work. I tried to use =\"...\" syntax, but it also did not work. I don't know what else to do.

Thanks for the help

Recommended Answers

One form can not contain another form.

Jump to Post

All 4 Replies

you forgot to close form tag for this

echo '<form action="delete_ad.php" method="post">';

close it before <table>

it will work.

One form can not contain another form.

you need to close the first form tag !

What everyone else has said plus you need the first line of your table in a row. You've got the <th> but it's not within a <tr> and since it's the only one in the row, you need to use colspan="2" too.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.