PHP echo <form > question?

Zyzagy

New member
I am trying to echo a form. The form shows fine but when I submit my form the action="file.php" does not work, and instead of going to file.php it goes back to the previous page.

Both of the following code samples don't work. I know its better to use html and then send it to file.php, but in these case I need it to work from echo.

echo '<table id="emailform" class="signup">
<th colspan="2" align="center">Email Form</th>
<form method="post" action="sendmessage.php" onSubmit="return validate(this)">
<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>
</tr></form></table>';

or

echo
"<form name=\"message\" method=\"post\" action=\"sendmessage.php\">
<input type=\"text\" maxlength=\"32\" name=\"name\" />
<input type=\"text\" maxlength=\"32\" name=\"senderemail\" />
<textarea name=\"message\"></textarea>
<input type=\"submit\" value=\"Send\" /></form>";

Thanks
file.php is just an example for sendmessage.php
 
Back
Top