Click to See Complete Forum and Search --> : Form question


turbodurso
08-20-2008, 11:11 AM
Hi, kind of new to this ... i have this form (http://www.turbodurso.dreamhosters.com/untitledmuse/site/form.html)

I'm not sure as to why the submit button does not seem to send the form to be processed by the script.

Is it the php?

<?
if (!isset($_POST['submit']) || $_SERVER['REQUEST_METHOD'] != "POST") {
exit("<p>You did not press the submit button</p>");
} else {
$exploits = "/(content-type|bcc:|cc:|document.cookie|onclick|onload|javascript|alert)/i";
$profanity = "/(beastial|bestial|blowjob|clit|****|***|cunilingus|cunillingus|cunnilingus|****|ejaculate|fag|felati o|fellatio|****|fuk|fuks|gangbang|gangbanged|gangbangs|hotsex|jism|jiz|kock|kondum|kum|kunilingus|or gasim|orgasims|orgasm|orgasms|phonesex|phuk|phuq|porn|pussies|pussy|spunk|xxx)/i";
$spamwords = "/(viagra|phentermine|tramadol|adipex|advai|alprazolam|ambien|ambian|amoxicillin|antivert|blackjack|ba ckgammon|texas|holdem|poker|carisoprodol|ciara|ciprofloxacin|debt|dating|porn)/i";
$bots = "/(Indy|Blaiz|Java|libwww-perl|Python|OutfoxBot|User-Agent|PycURL|AlphaServer)/i";

if (preg_match($bots, $_SERVER['HTTP_USER_AGENT'])) {
exit("<p>Known spam bots are not allowed.</p>");
}

foreach ($_POST as $key => $value) {
$value = trim($value);

if (empty($value)) {
exit("<p>Please fill in all the fields</p>");
} elseif (preg_match($exploits, $value)) {
exit("<p>Exploits and Malicious scripting not allowed</p>");
} elseif (preg_match($profanity, $value) || preg_match($spamwords, $value)){
exit("<p>Some words not allowed on this form</p>")
}

$_POST[$key] = stripslashes(strip_tags($value));
}

if (!ereg("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,6})$",strtolower($_POST["email"]))) {
exit("<p>Your email is not valid - please enter a valid e-mail address</p>");
}

$recipient = "india@mybeautifulcity.co.uk"
$subject = "Application form details"

$message = "You have received an application from : \n";
$message .= "First name: {$_POST['first_name']} \n";
$message .= "Last name: {$_POST['last_name']} \n";
$message .= "Title: {$_POST['title']} \n";
$message .= "Date of birth: {$_POST['dob']} \n";
$message .= "Gender: {$_POST['gender']} \n";
$message .= "Occupation: {$_POST['occupation']} \n";
$message .= "Job title: {$_POST['job_title']} \n";
$message = "Contact details are : \n";
$message .= "Address: {$_POST['address']} \n";
$message .= "City: {$_POST['city']} \n";
$message .= "County: {$_POST['county']} \n";
$message .= "E-mail: {$_POST['email']} \n";

if (mail($recipient,$subject,$message,$headers)) {
echo("<p>Thank you for applying, we will be in contact with you shortly</p>");
} else {
echo("<p>Sorry, there was an error processing your form - please contact UM by mail</p>")
}
?>

niczak
08-20-2008, 12:44 PM
I like to set a hidden form variable and just check for that, for example:

(in form code)

<input type="hidden" name="save" value="true" />


(in PHP code)

if(isset($_POST['save']))
{
// do stuff
}


Also be sure that you are indeed using the POST method in your form:

<form name="frmblah" method="post" action="">

turbodurso
08-20-2008, 01:22 PM
still nothing -

What i find strange is that i get no 'reaction' onclick of submit -

Thenn again its my first time doing this -

Any other ideas?

niczak
08-20-2008, 01:23 PM
Please post your form code here.

turbodurso
08-20-2008, 02:51 PM
<form name="um-form" method="post" action="process.php">
<input type="hidden" name="save" value="true" />
<fieldset id="fieldset_one">
<legend class=""><strong>1.</strong> Personal details</legend>
<div class="fm-set">
<label for="first_name">First name</label>
<input type="text" name="first_name"></input><br/>
</div>
<div class="fm-set">
<label for="last_name">Last name</label>
<input type="text" name="last_name"></input><br/>
</div>
<div class="fm-set">
<label for="title">Title</label>
<input type="text" name="title"></input><br/>
</div>
<div class="fm-set">
<label for="dob">Date of birth</label>
<input type="dob" name="dob"></input><br/>
</div>
<div class="fm-set">
<label for="title">Gender</label>
<input type="text" name="gender"></input><br/>
</div>
<div class="fm-set">
<label for="occupation">Occupation</label>
<input type="text" name="occupation"></input><br/>
</div>
<div class="fm-set">
<label for="job_title">Job Title</label>
<input type="text" name="job_title"></input>
</div>
</fieldset>

<fieldset id="fieldset_two">
<legend class=""><strong>2.</strong> Residence</legend>

<div class="fm-set">
<label for="address">Address</label>
<input type="text" name="address"></input><br/>
</div>
<div class="fm-set">
<label for="city">City</label>
<input type="text" name="city"></input><br/>
</div>
<div class="fm-set">
<label for="county">County</label>
<input type="text" name="county"></input><br/>
</div>
<div class="fm-set">
<label for="postcode">Postcode</label>
<input type="text" name="postcode"></input><br/>
</div>
<div class="fm-set">
<label for="country">Country</label>
<input type="text" name="country"></input><br/>
</div
<div class="fm-set">
<label for="email">E-mail</label>
<input type="text" name="email"></input><br/>
</div>
<div class="fm-set">
<label for="home_tel">Home tel</label>
<input type="text" name="home_tel"></input><br/>
</div>
<div class="fm-set">
<label for="work_tel">Work tel</label>
<input type="text" name="work_tel"></input><br/>
</div>
<div class="fm-set">
<label for="mob_tel">Mob tel</label>
<input type="text" name="mob_tel"></input><br/>
</div>

</fieldset>
<fieldset id="fieldset_three">
<legend class=""><strong>3.</strong> Becoming an Untitled Muse</legend>

<div class="fm-set">
<label for="recommended_by">Recommended by :</label>
<input type="text" name="recommended_by" class="no-float"></input><br/>
</div>

<div class="fm-set">
<label for="city" class="">Why do you want to become an Untitled Muse?</label><br/>
<textarea cols="30" rows="7" class=""/></textarea><br/>
</div>

<div class="fm-set">
<label for="interests">Please indicate the services of your interests :</label><br/>
<input name="interests" type="checkbox" value="image_consulting" class="no-lineheight">Image Consulting</input><br/>
<input name="interests" type="checkbox" value="rtw_hautecouture" class="no-lineheight">RTW Haute Couture</input><br/>
<input name="interests" type="checkbox" value="fine_jewellery" class="no-lineheight">Fine Jewellery</input><br/>
<input name="interests" type="checkbox" value="bespoke_events" class="no-lineheight">Bespoke Events</input><br/>
<input name="interests" type="checkbox" value="lifestyle_requests" class="no-lineheight">Lifestyle Requests</input><br/>
<input name="interests" type="checkbox" value="all" class="no-lineheight">All</input>
</div>
</fieldset>
</form>
<div class="clear"></div>
</div>

OctoberWind
08-20-2008, 07:06 PM
Here's the problem:


</form>
<div class="clear"></div>
</div>
</div>

<div id="footer">
<p>The information you kindly provide will be used in accordance with our privacy policy.</p>
<input name="submit" type="submit" value="SUBMIT"/>
</div>
</body>
</html>

Your submit button is outside your form. It has no idea what it's supposed to do.

turbodurso
08-21-2008, 05:00 AM
shame on me ... thank you for having a look ...