Need help with a form

Hi!

I’m working on a website with a friend and he’d like a form on the site that sends the information from the html to our e-mail address using php coding. We’ve come a good bit on the coding from just Googleing around and copy/pasting code, but now we’re stuck at one specific thing. Maybe it’s very easy to solve but we’re not very bright!

We have this feature on the site which lets other people tell us about their events, and then we add them to our site!

<tr>
 <td valign="top">
  <label for="payment">Payment *</label>
 </td>
 <td valign="top">
  <input  type="radio" name="payment1" value="free"> Free Entrance
 </td>
</tr>
<tr>
 <td valign="top">
 </td>
 <td valign="top">
  <input  type="radio" name="payment2" value="costs"> Event costs: <input  type="text" name="event_cost" maxlength="100" size="4">
 </td>
</tr>

We have 2 radio buttons. One is named “Free entrance” and the other is named “Event costs:”, after the second button is a text field. The idea here is, when some one checks the 2nd radio button (“event costs:”) they need to enter a price in the text field. And when they then hit the submit button it would send something like: “event costs: ?€” to our mail.

How do we make this work in php?

Hopefully this makes sense. We’re from Finland and our English isn’t the greatest, and the translations might look a bit wonky! :-[

Thanks a bunch in advance

/Robin

[sub](and btw, the html code might not even be 100% correct either… We’re not pros at this!)[/sub]

Which Operating System are u Using???

this is the php mail function
http://php.net/manual/en/function.mail.php

For ubuntu:

I’m using Windows 7

In a windows environment PHP uses SMTP .
You need to edit php.ini like this ->
http://www.php.net/manual/en/mail.configuration.php

and this is sample code

[php]function send_contact_form($strName, $strEmail, $strPhone, $strMessage)
{
$to = ‘[email protected]’;
$subject = ‘From the site’;
$message = ’


‘.$subject.’



Name: '.$strName.'
Email: ’
.$strEmail.'
Phone: '.$strPhone
.'

Message:
‘.$strMessage.’

';
$email = $strEmail;
$header = ‘MIME-Version: 1.0’ . “\r\n”;
$header .= ‘Content-type: text/html; charset=UTF-8’ . “\r\n”;
$header .= “From: $email\r\nReply-To: $email” . “\r\n”;

mail($to, $subject, $message, $header);
}[/php]

Hope u liked the answer(if yes give me karma)

This is easy example
http://www.w3schools.com/php/php_mail.asp

Sponsor our Newsletter | Privacy Policy | Terms of Service