Link to home
Create AccountLog in
Avatar of JiveMedia
JiveMediaFlag for Australia

asked on

Blank emails from PHP Spry Form

Hi,

On my website i have a PHP contact form with Spry Validation.
Even with the Spry Validation, i keep getting blank emails sent through from the form to my email.
Im not sure why this is happening, something server side i guess?
Could someone please help with this issue. The form and validation works fine when you enter in details as normal.
Please see the code for the PHP and HTML below.
<form action="enquiry-process.php" method="post" id="index-form">
<fieldset>
<legend>Enquiry</legend>

<div><span id="spry_name">
<input name="name" type="text" id="name" value="name" />
<span class="textfieldRequiredMsg">A value is required.</span></span></div>

<div><span id="spry_company">
<input name="company" type="text" id="company" value="company" />
</span></div>

<div><span id="spry_email">
<input name="email" type="text" id="email" value="email" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></div>

<div><span id="spry_phone">
<input name="phone" type="text" id="phone" value="phone" />
</span></div>

<div><span id="spry_enquiry">
<textarea name="enquiry" id="enquiry" cols="35" rows="6">enquiry</textarea>
<span class="textareaRequiredMsg">A value is required.</span></span></div>

<div>
<input name="submit" type="submit" value="submit" id="index-form-submit" />
</div>

</fieldset>
</form>

*** PHP Process Script ***
<?php

$name=$_POST['name'];
$company=$_POST['company'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$enquiry=$_POST['enquiry'];

$toaddress = 'email@email.com.au';

$subject = 'General Enquiry';

$mailcontent = "Name: ".$name."\n\n"
."Company: ".$company."\n\n"
."Email: ".$email."\n\n"
."Phone: ".$phone."\n\n"
."Enquiry: \n\n".$enquiry;

$fromaddress = "From: $email";

mail($toaddress, $subject, $mailcontent, $fromaddress);

?>

Open in new window

Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Hi JiveMedia,

I'd need to see the whole of the HTML (especially the javascript) to tell you but I am assuming something is not set right with the Spry Validation and thus the form submits.

Avatar of JiveMedia

ASKER

Hi jason1178,

Please see the attached.
I have removed client references and a few other bits of non essential information.

Thanks
enquiry-process.php
index.php
SpryValidationTextarea.css
SpryValidationTextField.js
SpryValidationTextField.css
SpryValidationTextarea.js
ASKER CERTIFIED SOLUTION
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Awesome, works great...thanks!