Jump to content

Carelkat

New Members
  • Posts

    6
  • Joined

  • Last visited

Carelkat's Achievements

Newbie

Newbie (1/5)

2

Reputation

  1. Thank you, I found a few java scripts to limit the amount of checkboxes. I will check them out.
  2. Hi, I hope you are well I have a dropdown menu and the next part of the form is checkboxes. I would like to make it so that what ever option you choose with the dropdown menu, must limit the amount of check boxes you can tick. So if you choose a package from the dropdown menu where you would like to play 2 courses, in the next part of the form you are only allowed to tick 2 courses from the tick boxes. So if you pick two courses, the other must fade out or some pop up message must appear to tell the user he can only choose two courses, or even after you hit the submit button it the error message can appear to choose the right amount of courses. Is this possible with PHP or is there some jQuery plugin that can do that. Thank you
  3. Thank you, thank you, thank you ginerjm. I went through the code over and over for about two days and could not find the mistake. And a thank you for a the lesson about the capital letters in naming my variables. That habit stopped a few minutes ago.
  4. It does not post an PHP error. Please look at the Booking page on bushveldgolf.co.za and fill it in. It just shows my error message, "Your message could not be send", but I get the message perfectly well. It does not want to go to the Thank you page.
  5. <?php $suspect = false; $pattern = '/Content-Type:|Bcc:|Cc:/i'; function isSuspect($val, $pattern, &$suspect) { if (is_array($val)) { foreach ($val as $item) { isSuspect($item, $pattern, $suspect); } } else { if (preg_match($pattern, $val)) { $suspect = true; } } } isSuspect($_POST, $pattern, $suspect); if (is_array($val)) { foreach ($val as $item) { isSuspect($item, $pattern, $suspect); } } else { if (preg_match($pattern, $val)) { $suspect = true; } } isSuspect($_POST, $pattern, $suspect); if (!$suspect) { foreach ($_POST as $key => $value) { $temp = is_array($value) ? $value : trim($value); if (empty($temp) && in_array($key, $required)) { $missing[] = $key; $$key = ''; } elseif (in_array($key, $expected)) { $$key = $temp; } } } if (!$suspect && !empty($b_mail)) { $validemail = filter_input(INPUT_POST, 'b_mail', FILTER_VALIDATE_EMAIL); if ($validemail) { $headers .= "\r\nReply-to: $validemail"; } else { $errors['b_mail'] = true; } } if (!$suspect && !$missing && !$errors) { $message = ''; foreach ($expected as $item) { if (isset($$item) && !empty($$item)) { $val = $$item; } else { $val = 'Not selected'; } if (is_array($val)) { $val = implode(', ', $val); } $item = str_replace(array('_', '-'), ' ', $item); $message .= ucfirst($item) . ": $val\r\n\r\n"; } $message = wordwrap($message, 70); $mailSent = mail($to, $subject, $message, $headers, $authenticate); if (!$mailsent) { $errors['mailfail'] = true; } } ?> <?php if (($_POST && $suspect) || ($_POST && isset($errors['mailfail']))) { ?> <p class="warning">Sorry your message could not be sent.</p> <?php echo ($suspect)?> <?php } elseif ($errors || $missing) { ?> <p class="warning">Please fix the item(s) indicated.</p> <?php }?> <?php $errors = array(); $missing = array(); if (isset($_POST['submit'])) { $to = "Carel Venter <bookings@bushveldgolf.co.za>"; $subject = "Booking"; $expected = array('b_name', 'b_surn', 'b_tele', 'b_mail', 'b_acco', 'b_golf', 'b_nong', 'b_pack', 'b_courses', 'b_dfrom', 'b_dto'); $required = array('b_name', 'b_surn', 'b_tele', 'b_mail', 'b_acco', 'b_golf', 'b_pack', 'b_courses', 'b_dfrom', 'b_dto'); if (!isset($_POST['b_courses'])) { $_POST['b_courses'] = array(); } if(!is_array($_POST['b_courses'])) { $_POST['b_courses'] = array($_POST['b_courses']); } $minimumChecked = 1; if (count($_POST['b_courses']) < $minimumChecked) { $errors['b_courses'] = true;} $headers = "From:" .$b_mail. "\r\n"; $headers .= "Content-Type: text/plain; charset=utf-8\r\n"; $authenticate = '-fcarel@bushveldgolf.co.za'; require './php_include/mail_process2.php'; if($mailsent) { //echo "Thank you, I wil get back to you soon."; header('Location:/thanks.php'); exit; } } ?> Hi, thank you for your time. I have this booking form, and its sends the email perfect. I get it with all the fields. The error message however keeps on appearing and it doesn't go to the thank you page. I include the top of the page, the top of the form, and the mail process form. I would really appreciate help.
  6. <td>Package:</td> <td><label> <br /> <select name="b_midw" id="b_midw"> <option value="0">Mid Week</option> <option value="1">One Round, Two Nights</option> <option value="2">Two Rounds, One Night</option> <option value="3">Three Rounds, Two Nights</option> <option value="4">Four Rounds, Three Nights</option> </select> <br /> <p> <select name="b_weeke" id="b_weeke"> <option value="0">Weekend</option> <option value="1">One Round, Two Nights</option> <option value="2">Two Rounds, Two Nights</option> <option value="3">Three Rounds, Two Nights</option> <option value="4">Four Persons, Two Golfers</option> </select> </p> <?php if ($missing && in_array('b_midw' || 'b_weeke', $missing)) { ?> <span class="warning">Package?</span> <?php } ?> <?php $errors = array(); $missing = array(); if (isset($_POST['submit'])) { $to = "Carel Venter <bookings@bushveldgolf.co.za>"; $subject = "Booking"; $expected = array('b_name', 'b_surn', 'b_tele', 'b_mail', 'b_acco', 'b_golf', 'b_nong', 'b_midw' || 'b_weeke', 'b_courses', 'b_dfrom', 'b_dto'); $required = array('b_name', 'b_surn', 'b_tele', 'b_mail', 'b_acco', 'b_golf', 'b_nong', 'b_midw' || 'b_weeke', 'b_courses', 'b_dfrom', 'b_dto'); Hi there, I hope you are well. I have two dropdown menus, but only one of the two needs to be selected. So top of the page I have: And then the menus:
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.