zo ook in magento zijn er veel oplossingen, maar het uitvoeren ervan is vaak wat lastig.
Ik heb momenteel een contact formulier gemaakt , zonder captcha ( want dat is alleen maar irritant). maar wel zo dat een bot niet je email eruit kan pikken en dus ook geen onzin mail kunt krijgen.
Nu werkt het formulier, ! alleen als hij nu verzonden is krijg je een bericht , op een aparte pagina met dat je berichtje verzonden is. maar het is de bedoeling dat je de site niet verlaat.
en ook als je een veld invult, is het gelukt om een melding te geven als hij leeg is , alleen deze melding doet hij ook op een andere pagina.
nu is het mogelijk om een veld rood te maken als hij niet ingevult is. alleen heb ik geen idee hoe.
dus wat moet het formulier doen:
- Verzenden zonder de website te verlaten. ( of een bericht op een pagina binnen het template)
- Als een veld leeg gebleven is , dat hij op de pagina blijft en aangeeft welk veld nog ingevult moet worden.
- geen captcha.
Dit is de code voor de pagina.
Code: Selecteer alles
<html>
<head>
<!--
To use this code, you'll need to update your email address in the javascript
on this page, and in the php code in submit.php
If you add any form fields to this page, you will also need to update the PHP script.
You are 100% allowed to remove the credit link at the bottom and do whatever
you like with the form. However, I would greatly appreciate it if you left
the link intact :)
Thanks,
-Nathan
-->
<title>Contact Form</title>
<style type="text/css">
.antispam { display:none;}
</style>
<script type="text/javascript">
// split your email into two parts and remove the @ symbol
var first = "info";
var last = "datbouwikzelf.nl";
</script>
</head>
<body>
<x1>Contact</x1><BR>
<br>
<x2>heb je een vraag , commentaar of wil je gewoon even iets kwijt.<BR>
stel hier je vraag!</x2><BR>
<BR>
<form method="post" action="submit.php">
<p>Naam:
<br /><input name="name" /></p>
<p>Email:
<br /><input name="email" /></p>
<p>Onderwerp:
<br /><input name="subject" /></p>
<!-- Important: if you add any fields to this page, you will also need to update the php script -->
<p class="antispam">vul hier niets in ! :
<br /><input name="url" /></p>
<p>Bericht:
<br /><textarea name="message" rows="10" cols="70"></textarea></p>
<p><input type="submit" class="buttonStyle" value=""/></p><BR>
<BR>
</form>
</body>
</html>
Code: Selecteer alles
<?php
// if the url field is empty
if(isset($_POST['url']) && $_POST['url'] == ''){
if($_POST["message"] == "" || $_POST["name"] == ""){
echo "<p></p>";
} else {
// then send the form to your email
mail( 'you@yoursite.com', 'Contact Form', print_r($_POST,true) );
}
// put your email address here
$youremail = 'info@datbouwikzelf.nl';
// prepare a "pretty" version of the message
// Important: if you added any form fields to the HTML, you will need to add them here also
$body = "This is the form that was just submitted:
Naam: $_POST[name]
Email: $_POST[email]
Onderwerp: $_POST[subject]
Bericht: $_POST[message]";
// Use the submitters email if they supplied one
// (and it isn't trying to hack your form).
// Otherwise send from your email address.
if( $_POST['email'] && !preg_match( "/[\r\n]/", $_POST['email']) ) {
$headers = "From: $_POST[email]";
} else {
$headers = "From: $youremail";
}
// finally, send the message
mail($youremail, 'Contact Form', $body, $headers );
}
// otherwise, let the spammer think that they got their message through
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Bedankt!</title>
</head>
<body>
<h1><x44>Bedankt</x44></h1>
<p><x55>Wij zullen je bericht zo snel mogelijk beantwoorden.</x55></p>
</body>
</html>