Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Server-side Scripting _ Help with simple form and email script

Posted by: IanTD May 5 2012, 02:07 PM

Hello,

This is my first post.

Here's my website: http://imsoliberal.com

I'm trying to create a simple one field form that posts the content directly to an email address.

This is the html for my form:

<table cellspacing="5" align="center">
<tr>
<td>
<img src="http://imsoliberal.com/wp-content/uploads/2012/05/post8.png" />
<form method="post" name="post" action="/email.php">
</td>
<td>
<input type="text" size="100" name="post">
</td>
<td valign="top">
<input type="image" src="http://imsoliberal.com/wp-content/uploads/2012/05/postbutton3.png" name="postbutton" alt="Post!">
</form>
</td>
</tr>
</table>

This is the php script that I uploaded to the root directory:

<?php

$post = $_POST['post'];

$to = "postittotheblog@imsoliberal.com";

mail($to,$post);

?>

Posted by: Darin McGrew May 5 2012, 03:14 PM

This seems to be about PHP, so I'm moving it to the server-side programming forum.

Posted by: Brian Chandler May 5 2012, 09:56 PM

Well, it's not clear what the question is, but the html syntax is messed up. <form>...</form> has to be a proper part of the syntactic tree, so it can go inside a <td>...</td> for example, or it can *contain* a <table>...</table>, but it can't straddle bits of the table such as ...</td><td>... as you have it.

I can't see particularly why this won't "work", but it is not safe for public use, since it can be used as a spam relay.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)