dotz Posted November 25, 2009 Share Posted November 25, 2009 hi, i simply cant get this form working, can someone please help me out... see attatchment the calculation works, but i cant get the content of the textfields to output to the mail... [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/182955-php-form-question/ Share on other sites More sharing options...
dotz Posted November 26, 2009 Author Share Posted November 26, 2009 <?php //If the form is submitted if(isset($_POST['submitted'])) { //Check to see if the honeypot captcha field was filled in if(trim($_POST['checking']) !== '') { $captchaError = true; } else { // i dont want to check this $earlybird = trim($_POST['earlybird']); $veszin = trim($_POST['veszin']); $normaal = trim($_POST['normaal']); $geenlunch = trim($_POST['geenlunch']); $wellunch = trim($_POST['wellunch']); $totaal = trim($_POST['totaal']); // end i dont want to check this // i do want to check this if(trim($_POST['contactvoorName']) === '') { $contactvoorNameError = 'Je bent je voornaam vergeten.'; $hasError = true; } else { $contactvoorName = trim($_POST['contactvoorName']); } if(trim($_POST['contactachterName']) === '') { $contactachterNameError = 'Je bent je achternaam vergeten.'; $hasError = true; } else { $contactachterName = trim($_POST['contactachterName']); } if(trim($_POST['contactAdres']) === '') { $contactAdresError = 'Je bent je adres vergeten.'; $hasError = true; } else { $contactAdres = trim($_POST['contactAdres']); } if(trim($_POST['contactpcWoonplaats']) === '') { $contactAdresError = 'Je bent je woonplaats vergeten.'; $hasError = true; } else { $contactWoonplaats = trim($_POST['contactpcWoonplaats']); } } // i know there are more fields, but fist i need to figure out how to get it mailed //If there is no error, send the email if(!isset($hasError)) { $emailTo = '[email protected]'; $subject = 'Contact Form Submission from '.$name; $sendCopy = trim($_POST['sendCopy']); $body = "earlybird: $earlybird n\n\ Veszin lid: $veszin n\n\ Normaal: $normaal n\n\ voornaam: $contactVoorname \n\n achternaam: $contactachterName \n\n adres: $contactAdres \n\n pc/plaats: $contactpcPlaats \n\n mobiel: $contactMobiel \n\n\n\n sportcentrum: $Sport_centrum \n\n sportcentrum adres: $Sport_adres \n\n sportcentrum postcode en plaats: $Sport_pcplaats \n\n sportcentrum email: $Sport_email"; $headers = 'From: My Site <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email; mail($emailTo, $subject, $body, $headers); if($sendCopy == true) { $subject = 'You emailed Your Name'; $headers = 'From: Your Name <[email protected]>'; mail($email, $subject, $body, $headers); } $emailSent = true; } } ?> // if needed i can attach tje .js files aswell <?php get_header(); ?> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/scripts/contact-form.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/scripts/calc.js"></script> <body onLoad="InitForm();" onreset="InitForm();"> <?php if(isset($emailSent) && $emailSent == true) { ?> <div class="thanks"> <h1>Bedankt, <?=$name;?></h1> <p> uw aanvraag is succesvol ontvangen, u krijgt binnenkort de bevestiging </p> </div> <?php } else { ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <h1><?php the_title(); ?></h1> <?php the_content(); ?> <?php if(isset($hasError) || isset($captchaError)) { ?> <p class="error">There was an error submitting the form.<p> <?php } ?> <h3>NOT DONE YET!!! dit formulier nog niet gebruiken!!!!</h3> <table width="583" border="0" align="left" cellpadding="10" cellspacing="0" bordercolor="#FFFFFF"> <tbody> <tr bgcolor="#FFCC00"> <td height="83" colspan="2" valign="top"><form action="<?php the_permalink(); ?>" id="contactForm" method="post"> <ol class="forms"> <p><b>Zumba toning WORKSHOP</b><br> <input type="checkbox" name="earlybird" value="147.50" <?php if(isset($_POST['earlybird'])) echo $_POST['earlybird'];?> onclick="this.form.total.value=calculateTotal(this);" /> "Early bird" tarief a 147.50 Euro <br/> <input type="checkbox" name="veszin" value="147.50" <?php if(isset($_POST['veszin'])) echo $_POST['veszin'];?> onClick="this.form.total.value=calculateTotal(this);" /> VES ZIN Member a 147.50 Euro <br/> <input type="checkbox" name="normaal" <?php if(isset($_POST['normaal'])) echo $_POST['normaal'];?> value="180.00" onclick="this.form.total.value=calculateTotal(this);" /> Normaal tarief a 180 Euro <br> <br> <b>Extra </b> <br> <input name="geenlunch" type="checkbox" value="0.00" onClick="this.form.total.value=calculateTotal(this);"> geen gebruikmaken van lunch buffet <br> <input name="wellunch " type="checkbox" value="11.00" onClick="this.form.total.value=calculateTotal(this);"> wel gebruikmaken van lunch buffet incl. koffie/thee en melk a 11.- Euro<br> <br> <br> <input type="hidden" name="calculatedTotal" value="0"> <input type="hidden" name="previouslySelectedRadioButton" value="0"> <strong>Totaal:</strong> <input type="text" name="total" readonly onFocus="this.blur();"></p> <p><strong>Deelnemer </strong> </p> <table width="90%" border="0" cellspacing="10" cellpadding="10"> <tr> <th width="35%" scope="col"><div align="left">voornaam</div> </label></th> <th width="65%" scope="col"> <input type="text" name="contactvoorName" id="contactvoorName" value="<?php if(isset($_POST['contactvoorName'])) echo $_POST['contactvoorName'];?>" /> <?php if($ContactvoornaamError != '') { ?> <span class="error"><?=$ContactvoornaamError;?></span> <?php } ?> </th> </tr> <tr> <th scope="row"><label for="label2"> achternaam </label></th> <td><label for="label"></label> <input type="text" name="contactachterName" id="contactachterName" value="<?php if(isset($_POST['contactachterName'])) echo $_POST['contactachterName'];?>" /> </td> </tr> <tr> <th scope="row"> <label for="adres">adres</label> </th> <td> <label for="adres"></label><input type="text" name="contactpcAdres" id="contactAdres" value="<?php if(isset($_POST['contactAdres'])) echo $_POST['contactAdres'];?>" /> </td> </tr> <tr> <th scope="row"> <label for="label3">PC / Woonplaats</label> </th> <td> <label for="label2"></label><input type="text" name="contactpcWoonplaats" id="contactpcWoonplaats" value="<?php if(isset($_POST['contactpcWoonplaats'])) echo $_POST['contactpcWoonplaats'];?>" /></td> </tr> <tr> <th scope="row"> <label for="label3">Land</label> </th> <td> <label for="label"></label> <input type="text" name="contactLand" id="contactLand" value="<?php if(isset($_POST['contactLand'])) echo $_POST['contactLand'];?>" /> </td> </tr> <tr> <th scope="row"> <label for="label2">Mobiel nr</label> </th> <td> <input type="text" name="contctMobiel" id="contactMobiel" value="<?php if(isset($_POST['contactMobiel'])) echo $_POST['contactMobiel'];?>" /> </td> </tr> <tr> <th scope="row"> <label for="label2">Sportcentrum</label></th> <td> <input type="text" name="Sport_centrum" id="Sport_centrum" value="<?php if(isset($_POST['Sport_centrum'])) echo $_POST['Sport_centrum'];?>" /> </td> </tr> <tr> <th scope="row"> <label for="label2">Adres</label> </th> <td> <input type="text" name="Sport_adres" id="Sport_adres" value="<?php if(isset($_POST['Sport_adres'])) echo $_POST['Sport_adres'];?>" /> </td> </tr> <tr> <th scope="row"> <label for="label2">PC / Plaats</label></th> <td><input type="text" name="Sport_pcplaats" id="Sport_pcplaats" value="<?php if(isset($_POST['Sport_pcplaats'])) echo $_POST['Sport_pcplaats'];?>" /></td> </tr> <tr> <th scope="row"><label for="label2">Email</label></th> <td> <input type="text" name="Sport_email" id="email6" value="<?php if(isset($_POST['Sport_email'])) echo $_POST['Sport_email'];?>" /> </td> </tr> <tr> <th colspan="2" scope="row"> <input type="checkbox" name="sendCopy" id="sendCopy" value="true"<?php if(isset($_POST['sendCopy']) && $_POST['sendCopy'] == true) echo ' checked="checked"'; ?> /> <label for="sendCopy">verstuur een kopie van dit formulier naar u zelf</label> <li class="screenReader"> <label for="checking" class="screenReader">Indien u dit formuler wil verzenden, <br> vul in het volgende veld dan niets in (anti spam)<br> </label> <input type="text" name="checking" id="checking" class="screenReader" value="<?php if(isset($_POST['checking'])) echo $_POST['checking'];?>" /> </li> </th> </tr> <tr> <th scope="row"> <li class="buttons"> <input type="hidden" name="submitted" id="submitted" value="true" /> <button type="submit">Verstuur</button> </li></th> <td>dit formulier nog niet gebruiken, gelieve uw aanvraag te versturen aan <a href="mailto:----------">-------</a></td> </tr> </table> </ol> </form> <?php endwhile; ?> <?php endif; ?> <?php } ?></td> </tr> <tr> <td height="83" colspan="2" valign="top"> </td> </tr> </tbody> </table> Link to comment https://forums.phpfreaks.com/topic/182955-php-form-question/#findComment-965841 Share on other sites More sharing options...
garethhall Posted November 26, 2009 Share Posted November 26, 2009 stop the mail function from running and echo $body just to see if you are getting the correct data <?php echo $body = "earlybird: $earlybird n\n\ Veszin lid: $veszin n\n\ Normaal: $normaal n\n\ voornaam: $contactVoorname \n\n achternaam: $contactachterName \n\n adres: $contactAdres \n\n pc/plaats: $contactpcPlaats \n\n mobiel: $contactMobiel \n\n\n\n sportcentrum: $Sport_centrum \n\n sportcentrum adres: $Sport_adres \n\n sportcentrum postcode en plaats: $Sport_pcplaats \n\n sportcentrum email: $Sport_email"; ?> Link to comment https://forums.phpfreaks.com/topic/182955-php-form-question/#findComment-965893 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.