/    Sign up×
Community /Pin to ProfileBookmark

Please help me with this Email Form

I have a Form from where user Will put the Name, Message and his mail Id. And The details will be mailed to specified Mail BOX. Now I Need to put a image instead of a Submit Button. If i put the Submit Button the Mail Easily Delivered to me. If i put the Image then its not delivering.. please help me what to do??

[CODE]
<?php
$error = “”;
$success = FALSE;
if(isset($_POST[‘submit’]))
{
foreach($_POST as $key => $val)
{
if(empty($_POST[$key]))
{
$error .= “You must enter a value for ” .
ucwords(str_replace(“_”,” “,$key)) . “. “;
}
else
{
if(get_magic_quotes_gpc())
{
$_POST[$key] = stripslashes($val);
}
}
if($key != ‘enquiry’)
{
$_POST[$key] = preg_replace(‘/[rn]/’, ‘ ‘, $val);
}
}
if($_POST[’email’] == 0)
{
//$error .= “‘{$_POST[’email’]}’ does not appear to be a valid email address. “;
}

$to = “xxx@***.com”;
$headers = “MIME-Version: 1.0rn”;
$headers .= “Content-type: text/html; charset=iso-8859-1rn”;
$headers .= “From: “.$_POST[’email’].”rn”;
$mail = @mail($to,$_POST[‘name’],$_POST[‘enquiry’],$headers);
if(!$mail)
{
$error .= “There was an unknown error occurred “;
}
else
{
$error .= “Your message has been successfully sent. “;
}
}

?>

<form name=”ContactUs” method=”post” action=”../index.php?main_page=contact_us&action=success”>
<table width=”100%” border=”0″ cellspacing=”2″ cellpadding=”2″ >
<tr>
<td class=”plainBoxHeading” colspan=”2″>NAME</td>
</tr>
<tr>
<td class=”main” colspan=”2″><input name=”name” type=”text”></td>
</tr>
<tr>
<td class=”plainBoxHeading” colspan=”2″>EMAIL</td>
</tr>
<tr>
<td class=”main” colspan=”2″><input name=”email” type=”text” size=”50″></td>
</tr>
<tr>
<td class=”plainBoxHeading” colspan=”2″>Message</td>
</tr>
<tr>
<td class=”main” colspan=”2″><textarea name=”enquiry” cols=”50″ rows=”15″></textarea></td>
</tr>
<tr>
<td align=”right” class=”main”><a href =” javascript : submitForm(); “><img src=”../includes/templates/template_default/buttons/english/button_send.gif” alt=”send now”></a></td>
</tr>
</table>
</form>

<script language = “javascript”>
function submitForm() {
document.ContactUs.submit();
}
</script>

[/CODE]

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@felgallApr 26.2007 — You are using the wrong sort of image. The following type of image is a direct substitute for a submit button and will submit the form when selected.

&lt;input type="image" src="../includes/templates/template_default/buttons/english/button_send.gif" alt="send now"&gt;
Copy linkTweet thisAlerts:
@NogDogApr 26.2007 — Also, some browsers (IE) do not play nicely when it comes to sending the name/value pair of a submit button that is not an <input type="submit"> element, so it's probably a good idea to either create a hidden element or use one of the other form elements in your if clause that determines if the form has been submitted and needs to be processed. (Or, just check to see if $_SERVER['REQUEST_METHOD'] == 'POST'.)
×

Success!

Help @mishu007 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...