In other words i have developed a form tryed sending it to my email and it does not get there !
Are there some kind of permissions that have to be set
anyway here is my form
index php
[php]
', $msg , '
- Name * <?php if (isset($err_myname)) { echo $err_myname; } ?> <?php if (isset($err_patternmatch)) { echo $err_patternmatch; } ?>
<li>
<label for="mypassword">Password</label>
<input type="password" name="mypassword" id="mypassword" value="<?php if (isset($mypassword)) { echo $mypassword; } ?>" />
<?php if (isset($err_passlength)) { echo $err_passlength; } ?>
</li>
<li>
<label for="mypasswordconf">Password (confirm)</label>
<input type="password" name="mypasswordconf" id="mypasswordconf" value="<?php if (isset($mypasswordconf)) { echo $mypasswordconf; } ?>" />
<?php if (isset($err_mypassconf)) { echo $err_mypassconf; } ?>
</li>
<li>
<div class="grouphead">Os</div>
<ol>
<li>
<input type="checkbox" name="Os[]" value="Windows" id="winditem"
<?php if ((isset($Os)) && (in_array("Windows", $Os))) { echo "checked"; } ?> />
<label for="winditem">Windows</label>
</li>
<li>
<input type="checkbox" name="Os[]" value="apple" id="appleitem"
<?php if ((isset($Os)) && (in_array("apple", $Os))) { echo "checked"; } ?> />
<label for="appleitem">Apple</label>
</li>
<li>
<input type="checkbox" name="Os[]" value="other" id="otheritem"
<?php if ((isset($favoritemusic)) && (in_array("other", $Os))) { echo "checked"; } ?> />
<label for="otheritem">Other</label>
</li>
</ol>
</li>
<li>
<label for="reference">How did you hear about us?</label>
<select name="reference" id="reference">
<option value="">Choose...</option>
<option value="friend"
<?php if ((isset($reference)) && ($reference === 'friend')) { echo "selected"; } ?>>A friend</option>
<option value="facebook"
<?php if ((isset($reference)) && ($reference === 'facebook')) { echo "selected"; } ?>>Facebook</option>
<option value="twitter"
<?php if ((isset($reference)) && ($reference === 'twitter')) { echo "selected"; } ?>>Twitter</option>
</select>
</li>
<li>
<div class="grouphead">Job Type</div>
<ol>
<li>
<input type="radio" name="jobtype" value="hardware" id="hardwareitem" <?php if ((isset($jobttype)) && ($jobttype==='hardware')) { echo "checked"; } ?>/>
<label for="hardwareitem">Hardware</label>
</li>
<li>
<input type="radio" name="jobtype" value="virus" id="virusitem" <?php if ((isset($jobtype)) && ($jobtype === 'virus')) { echo "checked"; } ?> />
<label for="virusitem">Virus</label>
</li>
<li>
<input type="radio" name="jobtype" value="no-idea" id="no-ideaitem" <?php if ((isset($jobtype)) && ($jobttype === 'no-idea')) { echo "checked"; } ?> />
<label for="no-ideatem">No Idea</label>
</li>
</ol>
</li>
<li>
<label for="mycomments">Comment below on your problem: (html is not allowed)</label>
<textarea name="mycomments" id="mycomments"><?php if (isset($mycomments)) { echo $mycomments; } ?></textarea>
</li>
</ol>
<button type="submit" name="action" value="submit">send</button><div></div>
<?php endif ?>
process.php
[php]
<?php ini_set('error_reporting', E_ALL); ini_set('display_errors', '1'); if (($_SERVER['REQUEST_METHOD'] == 'POST') && (!empty($_POST['action']))): if (isset($_POST['myname'])) { $myname = $_POST['myname']; } if (isset($_POST['mypassword'])) { $mypassword = $_POST['mypassword']; } if (isset($_POST['mypasswordconf'])) { $mypasswordconf = $_POST['mypasswordconf']; } if (isset($_POST['mycomments'])) { $mycomments = filter_var($_POST['mycomments'], FILTER_SANITIZE_STRING ); } if (isset($_POST['reference'])) { $reference = $_POST['reference']; } if (isset($_POST['Os'])) { $Os = $_POST['Os']; } if (isset($_POST['jobtype'])) { $jobtype = $_POST['jobtype']; } $formerrors = false; if ($myname === '') : $err_myname = 'Sorry, your name is a required field
';
$formerrors = true;
endif; // input field empty
if (strlen($mypassword) <= 6):
$err_passlength = 'Sorry, the password must be at least six characters
';
$formerrors = true;
endif; //password not long enough
if ($mypassword !== $mypasswordconf) :
$err_mypassconf = 'Sorry, passwords must match
';
$formerrors = true;
endif; //passwords don't match
if ( !(preg_match('/[A-Za-z]+, [A-Za-z]+/', $myname)) ) :
$err_patternmatch = 'Sorry, the name must be in the format: Last, First
';
$formerrors = true;
endif; // pattern doesn't match
$formdata = array (
'myname' => $myname,
'mypassword' => $mypassword,
'mypasswordconf' => $mypasswordconf,
'mycomments' => $mycomments,
'reference' => $reference,
'Os' => $Os,
'jobtype' => $jobtype,
);
if (!($formerrors)) :
$to = "[email protected]";
$subject = "From $myname -- Signup Page";
$message = json_encode($formdata);
$replyto = "From: [email protected] \r\n".
"Reply-To: [email protected] \r\n";
if (mail($to, $subject, $message)):
$msg = "Thanks for filling out our form";
else:
$msg = "Problem sending the message";
endif; // mail form data
endif; // check for form errors
endif; //form submitted
?>
[/php]
[/php]