Page 1 of 1

Checklist, Dropdown Menu in Email Form

Posted: Mon Oct 19, 2009 6:40 am
by olicorse
Hi Guys,


I've made email forms in the past but only with text areas. Now I want to make an email form which contains a checklist and drop down list but don't know how to make the PHP page collect the data. Could someone please help me?


Here is the HTML: (I also put this in the head section: <form action="rpw_contact.php" method="post"></head>)



</div>

<div id="main">

<div id="page_header">

<h2>Contact</h2>

</div>

<p>Please contact us with any queries using the form below.</p>

<p> </p>

<form id="form1" name="form1" method="post" action="">

<p>Name

<input name="name" type="text" id="name" size="30" />

</p>

<p> </p>

<p>Nature of business

<input name="business" type="text" id="business" size="30" />

</p>

<p> </p>

<p>Contact number

<input name="phone" type="text" id="phone2" size="30" />

</p>

<p> </p>

<p>Email address

<input name="email" type="text" id="email" size="30" />

</p>

<p><br />

I am interested in the following:<br />

<br />

</p>

<p>

<label>

<input type="checkbox" name="box1" value="option1"

id="Services_0" />

Web Design</label>

</p>

<p>

<label>

<input type="checkbox" name="box1" value="option2"

id="Services_1" />

Content Management System</label>

<br />

<label>

<input type="checkbox" name="box1" value="option3"

id="Services_2" />

E-Commerce</label>

</p>

<p>

<label>

<input type="checkbox" name="box1" value="option4"

id="Services_3" />

Search Engine Optimisation</label>

</p>

<p>

<label>

<input type="checkbox" name="box1" value="option5"

id="Services_4" />

Other</label>

<br />

</p>

<p> </p>

<p>Message: </p>

<p>

<textarea name="message" id="message" cols="40" rows="5"></

textarea>

</p>

<p> </p>

<p>Finally, please tell us where you heard about us:</p>

<p> </p>

<p>

<select name="find" size="1" id="find">

<option selected="selected">Please choose...</option>

<option>Word of mouth</option>

<option>Direct Mail

</option>

<option>Magazine ad</option>

<option>Internet</option>

<option>Other</option>

</select>

</p>

<p> </p>

<p>

<input type="submit" name="submit" id="submit"

value="Submit" />

<br />

</p>

</form>


and here is the PHP script I normally use:



<?php

if (get_magic_quotes_gpc()) {

function stripslashes_deep($value)

{

$value = is_array($value) ?

array_map('stripslashes_deep', $value) :

stripslashes($value);

return $value;

}

$_POST = array_map('stripslashes_deep', $_POST);

$_GET = array_map('stripslashes_deep', $_GET);

$_COOKIE = array_map('stripslashes_deep', $_COOKIE);

$_REQUEST = array_map('stripslashes_deep', $_REQUEST);

}

$name = $_POST['name'];

$subject = 'Website Engquiry'

$phone = $_POST['phone'];

$email = $_POST['email'];

$message = $_POST['message'];

$enquiry = "Name: " . $name ;

$enquiry .= "\n\nPhone: " . $telephone;

$enquiry .= "\n\nEnquiry: " .$message;

mail('info@olicorse.com', $services, $enquiry,

'From:' . $name . ' <' . $email . '>');

header('Location:thanks.html');

?>


Please advise what I need to add to the PHP script to make it work.


Thanks in advance!


Oli