-3

Im trying to create a form to send me an email when the user fills all the fields, I followed a tutorial to put it together so whats there works, but I want to implement an option that allows people to pick other... Heres how it is:

I have a form that asks for your: Name, Email, Type and Message.

The type has 4 options: Feedback, Bug Report, Feature Request and other, I would love if when the other radio button is clicked then the text box HAS to have an input, so they cant just skip by pressing other, but if they pick something else that isnt other then I dont want them to have to type in the text box, but no matter what I try it either doesnt work at all or HAS to have an input in the text box even if I dont select the other radio button...

The problem is resolved, I request that this topic remains open so that others can continue to use this page, or incase I break something... Thanks Rasclatt, You were an amazing help :)

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.js"></script>
<link href="contact/css/contactForm.css" rel="stylesheet">
<title>Contact Us</title>
<?php error_reporting(0); ?>
<?php if(isset($_POST['Email'])): ?>
    <?php
    print_r($_POST); 
            // This is where you process the email and display the thank you page
            $to      = 'harryfelton12@gmail.com';
            $subject = 'ALERT! Website Form Submission';
            $message = 'Users Email: '.strip_tags($_POST['Email'])."\n";
            $message .= 'Submitted Message: '.strip_tags($_POST['Comment'])."\n";
            $message .= 'Message Type: '.strip_tags($_POST['Type'])."\n";
            $headers = 'From: harrywebsite@form.com' . "\r\n" .
                'Reply-To: '.strip_tags($_POST['Email']) . "\r\n";
            // If the mail is successful, display thanks or display failed
            ?>
            <?php if(mail($to, $subject, $message, $headers)): ?>
                // Display the thank you page }
                <div id="comments_form">
                  <h2 style="size:35px;">Thanks For Your Message!</h2>          
                  <p style="font-size: 20px; font-family:Arial, Helvetica, sans-serif; color:#000; margin-left: 25px;">You Will Be Redirected Shortly!</p>           
                  <p style="font-size: 15px; font-family:Arial, Helvetica, sans-serif; color:#000; margin-left: 25px;">Expect your message to be responded to within 2 working days</p>
                    <script type="text/javascript">
                      setTimeout('redirectPage()', 3000)
                        function redirectPage() {
                            location.href="index.html"  
                        };
                </script>
            <?php else: ?>
              <div id="comments_form">
                <h2 style="size:35px;">Uh Oh! Your Message Could Not Be Sent</h2>           
                <p style="font-size: 20px; font-family:Arial, Helvetica, sans-serif; color:#000; margin-left: 25px;">An Unexpected Error Occured While Trying To Send Your Message</p>           
                <p style="font-size: 15px; font-family:Arial, Helvetica, sans-serif; color:#000; margin-left: 25px;">You Are Being Redirected To The Home Page</p>
                  <script type="text/javascript">
                    setTimeout('redirectPage()', 3000)
                      function redirectPage() {
                        location.href="index.html"  
                       };
                </script>
            <?php endif ?>
    </div>
<?php  else: ?>
<form method="post" id="comments_form">
    <div class="row">
        <div class="label">
            Your Name
        </div>
        <!--.label end-->
        <div class="input">
            <input type="text" id="fullname" class="detail" name="Name"
                value="<?php echo isset($_POST['Name'])? $_POST['Name'] : ''; ?>" />
            <?php if(in_array('Name', $validation)): ?>
            <span class="error"><?php echo $error_messages['Name']; ?></span>
            <?php endif; ?>
        </div>
        <!--.input end-->
        <div class="context">
            e.g. John Smith or Jane Doe
        </div>
        <!--end .context-->
    </div>
    <!--.row end-->

    <div class="row">
        <div class="label">
            Your Email
        </div>
        <!--.label end-->
        <div class="input">
            <input type="text" id="email" class="detail" name="Email" value="<?php echo isset($_POST['Email'])? $_POST['Email'] : ''; ?>" />
            <?php if(in_array('Email', $validation)): ?>
            <span class="error"><?php echo $error_messages['Email']; ?></span>
            <?php endif; ?>
        </div>
        <!--.input end-->
        <div class="context">
            We wont spam you! We only need this to reply to questions you might pose
        </div>
        <!--end .context-->
    </div>
    <!--.row end-->

    <div class="row">
        <div class="label">
            Type Of Message
        </div>
        <!--.label end-->
        <div class="input">
            <input type="radio" name="Type" onChange="GetValue(this)"  value="Feedback" checked="checked" /> 
            Feedback <br />
            <input type="radio" name="Type" onChange="GetValue(this)" value="Feature Request" <?php echo (isset($_POST['Type']) && $_POST['Type'] == 'Feature Request')? 'checked="checked"' : ''; ?> />
            Feature Request<br>
            <input type="radio" name="Type" onChange="GetValue(this)" value="Bug Report" <?php echo (isset($_POST['Type']) && $_POST['Type'] == 'Bug Report')? 'checked="checked"' : ''; ?> />
            Bug Report<br>
            <input type="radio" name="Type" onChange="GetValue(this)" value="Other" id="other" <?php echo (isset($_POST['Type']) && $_POST['Type'] == 'Other')? 'checked="checked"' : ''; ?> />
            Other<br />
          <input type="text" style="display:none;" id="option" name="Type" <?php echo (isset($_POST['Type']) && $_POST['Type'] == 'option')? 'checked="checked"' : ''; ?> />
          <?php if(in_array('Type', $validation)): ?>
            <span class="error"> <?php echo $error_messages['Type']; ?> </span>
          <?php endif; ?>
        </div>
        <!--.input end-->
        <div class="context">
            This is to help us better respond to your message
        </div>
        <!--end .context-->
    </div>
    <!--.row end-->

    <div class="row">
        <div class="label">
            Your Message
        </div>
        <!--.label end-->
        <div class="input2">
            <textarea id="Comment" name="Comment" class="mess"><?php echo isset($_POST['Comment'])? $_POST['Comment'] : ''; ?></textarea>
            <?php if(in_array('Comment', $validation)): ?>
            <span class="error"><?php echo $error_messages['Comment']; ?></span>
            <?php endif; ?>
        </div>
        <!--.input end-->
    </div>
    <!--.row end-->

    <div class="submit">
        <input type="submit" id="submit" name="Submit" value="Send Message" />
    </div>
</form>
<?php endif; ?>
<script>
    // This function just checks if the 'other' gets checked
function GetValue(ThisVal) {
    var Writing = $(ThisVal).val();
    // This just shows you what is happening via the feedback div
    $('#feederback').html(Writing);
    if (Writing == 'Other') {
        // If other, disable the submit
        $("#submit").prop("disabled", true);
        // Fade in the message textarea
        $('#option').fadeIn('fast');
        // Check the message area to see if there is text in it already.
        // If there is text enable the submit button
        CheckVal();
    } else {
        // If not other, fade out the message
        $('#option').fadeOut('fast');
        // Enable the submit button
        $('#submit').prop("disabled", false);
    }
}

function CheckVal() {
    var SetMess = $('#option').val();
    $('#feedback').html(SetMess);

    if (SetMess !== '')  {
            $('#submit').prop('disabled', false);
        }
    else {
            $('#submit').prop('disabled', true);
        }
}
// As one types, check that the message is not empty
$('#option').keyup(function () {
    CheckVal();
});
// As one clicks into the field, see if it has content
$('#option').click(function () {
    CheckVal();
});

        $(document).ready(function() {
            // validate form
            $("#comments_form").validate({
                // This will allow you to extend the validator functions
                invalidHandler: 
                        function(form, validator) {
                          //  $("#get_online").val("CHECK");
                    },
                rules: {
                    // For every named input that you want to validate,
                    // you create a little set of prefs
                    Name: {
                        required: true,
                    },
                    Email: {
                                required: true,
                                email: true
                            },

                    Type: { required: true },
                    Comment: { required: true },
                    },
                messages: {
                        // Here are just the custom messages you can modify per field
                        Name: {
                                required: 'Please Enter Your Name', 
                            },
                        Email: {
                                required: 'Please Enter An Email',
                                email: 'Email address not valid',
                            },
                        Type: { required: 'Please Select A Type' },
                        Comment: { required: 'Please Enter A Message'},
                    },
            });
        });
</script>

-Thanks in advance, harry

Harry
  • 304
  • 4
  • 14

1 Answers1

0

Ok so the validation is at the very bottom. I have it validating basic stuff. If you visit or google jQuery validation, you can see how to validate different fields. It's pretty easy. Make sure in your PHP that you filter ( strip_tags() ) the inputs so that you don't get hacked.

     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.js"></script>
<link href="contact/css/contactForm.css" rel="stylesheet">
<title>Contact Us</title>
<?php error_reporting(0); ?>
<?php if(isset($_POST['Email'])): ?>
    <?php
    print_r($_POST); 
            // This is where you process the email and display the thank you page
            $to      = 'harryfelton12@gmail.com';
            $subject = 'ALERT! Website Form Submission';
            $message = 'Users Email: '.strip_tags($_POST['Email'])."\n";
            $message .= 'Submitted Message: '.strip_tags($_POST['Comment'])."\n";
            $message .= 'Message Type: ';
            $message .= ($_POST['Type'] !== 'Option')? $_POST['Type']."\n": strip_tags($_POST['option'])."\n";
            $headers = 'From: harrywebsite@form.com' . "\r\n" .
                'Reply-To: '.strip_tags($_POST['Email']) . "\r\n";
            // If the mail is successful, display thanks or display failed
            ?>
            <?php if(mail($to, $subject, $message, $headers)): ?>
                // Display the thank you page }
                <div id="comments_form">
                  <h2 style="size:35px;">Thanks For Your Message!</h2>          
                  <p style="font-size: 20px; font-family:Arial, Helvetica, sans-serif; color:#000; margin-left: 25px;">You Will Be Redirected Shortly!</p>           
                  <p style="font-size: 15px; font-family:Arial, Helvetica, sans-serif; color:#000; margin-left: 25px;">Expect your message to be responded to within 2 working days</p>
                    <script type="text/javascript">
                      setTimeout('redirectPage()', 3000)
                        function redirectPage() {
                            location.href="index.html"  
                        };
                </script>
            <?php else: ?>
              <div id="comments_form">
                <h2 style="size:35px;">Uh Oh! Your Message Could Not Be Sent</h2>           
                <p style="font-size: 20px; font-family:Arial, Helvetica, sans-serif; color:#000; margin-left: 25px;">An Unexpected Error Occured While Trying To Send Your Message</p>           
                <p style="font-size: 15px; font-family:Arial, Helvetica, sans-serif; color:#000; margin-left: 25px;">You Are Being Redirected To The Home Page</p>
                  <script type="text/javascript">
                    setTimeout('redirectPage()', 3000)
                      function redirectPage() {
                        location.href="index.html"  
                       };
                </script>
            <?php endif ?>
    </div>
<?php  else: ?>
<form method="post" id="comments_form">
    <div class="row">
        <div class="label">
            Your Name
        </div>
        <!--.label end-->
        <div class="input">
            <input type="text" id="fullname" class="detail" name="Name"
                value="<?php echo isset($_POST['Name'])? $_POST['Name'] : ''; ?>" />
            <?php if(in_array('Name', $validation)): ?>
            <span class="error"><?php echo $error_messages['Name']; ?></span>
            <?php endif; ?>
        </div>
        <!--.input end-->
        <div class="context">
            e.g. John Smith or Jane Doe
        </div>
        <!--end .context-->
    </div>
    <!--.row end-->

    <div class="row">
        <div class="label">
            Your Email
        </div>
        <!--.label end-->
        <div class="input">
            <input type="text" id="email" class="detail" name="Email" value="<?php echo isset($_POST['Email'])? $_POST['Email'] : ''; ?>" />
            <?php if(in_array('Email', $validation)): ?>
            <span class="error"><?php echo $error_messages['Email']; ?></span>
            <?php endif; ?>
        </div>
        <!--.input end-->
        <div class="context">
            We wont spam you! We only need this to reply to questions you might pose
        </div>
        <!--end .context-->
    </div>
    <!--.row end-->

    <div class="row">
        <div class="label">
            Type Of Message
        </div>
        <!--.label end-->
        <div class="input">
            <input type="radio" name="Type" onChange="GetValue(this)"  value="Feedback" checked="checked" /> 
            Feedback <br />
            <input type="radio" name="Type" onChange="GetValue(this)" value="Feature Request" <?php echo (isset($_POST['Type']) && $_POST['Type'] == 'Feature Request')? 'checked="checked"' : ''; ?> />
            Feature Request<br>
            <input type="radio" name="Type" onChange="GetValue(this)" value="Bug Report" <?php echo (isset($_POST['Type']) && $_POST['Type'] == 'Bug Report')? 'checked="checked"' : ''; ?> />
            Bug Report<br>
            <input type="radio" name="Type" onChange="GetValue(this)" value="Other" id="other" <?php echo (isset($_POST['Type']) && $_POST['Type'] == 'Other')? 'checked="checked"' : ''; ?> />
            Other<br />
          <input type="text" style="display:none;" id="option" name="option" <?php echo (isset($_POST['option']))? $_POST['option']: ''; ?> />
          <?php if(in_array('Type', $validation)): ?>
            <span class="error"> <?php echo $error_messages['Type']; ?> </span>
          <?php endif; ?>
        </div>
        <!--.input end-->
        <div class="context">
            This is to help us better respond to your message
        </div>
        <!--end .context-->
    </div>
    <!--.row end-->

    <div class="row">
        <div class="label">
            Your Message
        </div>
        <!--.label end-->
        <div class="input2">
            <textarea id="Comment" name="Comment" class="mess"><?php echo isset($_POST['Comment'])? $_POST['Comment'] : ''; ?></textarea>
            <?php if(in_array('Comment', $validation)): ?>
            <span class="error"><?php echo $error_messages['Comment']; ?></span>
            <?php endif; ?>
        </div>
        <!--.input end-->
    </div>
    <!--.row end-->

    <div class="submit">
        <input type="submit" id="submit" name="Submit" value="Send Message" />
    </div>
</form>
<?php endif; ?>
<script>
    // This function just checks if the 'other' gets checked
function GetValue(ThisVal) {
    var Writing = $(ThisVal).val();
    // This just shows you what is happening via the feedback div
    $('#feederback').html(Writing);
    if (Writing == 'Other') {
        // If other, disable the submit
        $("#submit").prop("disabled", true);
        // Fade in the message textarea
        $('#option').fadeIn('fast');
        // Check the message area to see if there is text in it already.
        // If there is text enable the submit button
        CheckVal();
    } else {
        // If not other, fade out the message
        $('#option').fadeOut('fast');
        // Enable the submit button
        $('#submit').prop("disabled", false);
    }
}

function CheckVal() {
    var SetMess = $('#option').val();
    $('#feedback').html(SetMess);

    if (SetMess !== '')  {
            $('#submit').prop('disabled', false);
        }
    else {
            $('#submit').prop('disabled', true);
        }
}
// As one types, check that the message is not empty
$('#option').keyup(function () {
    CheckVal();
});
// As one clicks into the field, see if it has content
$('#option').click(function () {
    CheckVal();
});

        $(document).ready(function() {
            // validate form
            $("#comments_form").validate({
                // This will allow you to extend the validator functions
                invalidHandler: 
                        function(form, validator) {
                          //  $("#get_online").val("CHECK");
                    },
                rules: {
                    // For every named input that you want to validate,
                    // you create a little set of prefs
                    Name: {
                        required: true,
                    },
                    Email: {
                                required: true,
                                email: true
                            },

                    Type: { required: true },
                    Comment: { required: true },
                    },
                messages: {
                        // Here are just the custom messages you can modify per field
                        Name: {
                                required: 'Please Enter Your Name', 
                            },
                        Email: {
                                required: 'Please Enter An Email',
                                email: 'Email address not valid',
                            },
                        Type: { required: 'Please Select A Type' },
                        Comment: { required: 'Please Enter A Message'},
                    },
            });
        });
</script>
Rasclatt
  • 12,498
  • 3
  • 25
  • 33
  • I added the error message for the comment box so that if there was no message it would come up, instead it reloads the page as if to say that it passed validation... Also, how do I implement a message system so it actually send the message, is there a way of making a table appear in the email with a column for the names of the input and then a column for the value that they entered, if that's too complex, then just plain text is good as long as the name of the input is displayed so I know what it is... But just an explanation or better yet an example. – Harry Sep 09 '14 at 21:38
  • To actually mail you will want to use the `mail()` function `php` has built in. Here is a great resource! [http://www.w3schools.com/php/php_form_url_email.asp](http://www.w3schools.com/php/php_form_url_email.asp). – Rasclatt Sep 09 '14 at 21:49
  • That w3schools site will tell you everything you need to know about validating your email and sending the email. Three things to look up to sanitize user input to mitigate hacking are these main php function: `htmlentities()`,`htmlspecialchars()`, and `strip_tags()`. Cheers. – Rasclatt Sep 10 '14 at 04:16
  • The website doesnt seem to address checking if all fields are filled, I know how to send the mail, just not how to make it send when you click the button and ALL fields are filled, Also, a thank you page is what im trying to do, so when you press the button it clears the screen and says thanks – Harry Sep 10 '14 at 04:50
  • Well, with validation from jQuery, you will assume that all the fields you require filled will be filled so you just have to worry about filtering the `$_POST` array inputs to remove any malicious code when inserting into the `mail()` function (particularly in regards to the body of the email). The jQuery already checked that the mail was formatted properly, so just your other inputs need to be filtered using the functions I mentioned previously. The thank you page can be the same page but will display with an `if` condition at the top of the page. – Rasclatt Sep 10 '14 at 04:59
  • Well, If the message or name arent filled, will the jQuery stop the message being sent? I havent used PHP enough to really understand the concept of the IF statement, What would I compare, And then how would I change that value accordingly? Or is there some sort of "FormComplete" value automatically changed? – Harry Sep 10 '14 at 05:03
  • So, If im correct the htmlentities is the same as htmlspecialchars in the way it converts HTML to a string so malicious code cannot be run? And the strip_tags just removes any html tags? – Harry Sep 10 '14 at 05:09
  • It converts all html tags so they are rendered useless for running code on the page, and yes, `strip_tags()` removes tags entirely so that all that remains is what's in between the tags. Also, you had an error in your validation code. That is why your validation was not working for the `Comment` field. Copy my revised edit and it will validate that `textarea` now. – Rasclatt Sep 10 '14 at 05:15
  • I think I already fixed the texxtarea, I posted my edit in the main post, Unless you found another issue... with the validation, I got all that sorted, but when the user click the button is there a way of getting it to check if the form is valid and then display a thank you page because all the information ive found so far doesnt seem applicable to this script... Particularly the $_POST and how to strip it of code... – Harry Sep 10 '14 at 05:23
  • Oh yeah, you fixed it. I was running from a previous edit. What you need to do is break your page into 2 parts: `if(isset($_POST['Email'])) { process/send email, display thank you page } else { show this form }` – Rasclatt Sep 10 '14 at 05:28
  • nvm, It works perfectly, thanks, now i gotta get my head around these functions :P – Harry Sep 10 '14 at 05:31
  • This is how Im starting the form, But I dont know if its correct or how to use it.. Is this correct: `code
    " id="comments_form"> `
    – Harry Sep 10 '14 at 05:39
  • When the user completes the form (which won't allow them to click submit until they fill the fields), they click submit which will go to the 'contact.php' page (I assumed it was this page, but maybe not) and send the fields in a `$_POST` array. Do `print_r($_POST)` on the `contact.php` to see what your form is submitting. There you will see `Email`. – Rasclatt Sep 10 '14 at 05:40
  • Well the submit button is only disabled when you click the other button, the other fields can remain empty and the button is clickable, although it will print an error message, check out the link in the main post to see what I mean. Also the message used to be processed in the same file, it was just one .php file, is there a way of creating and sending the message,Ill update the script in the post so you can see what ive got. – Harry Sep 10 '14 at 05:42
  • What you did looks great, on that same page after it reloads to the thank you, it should first process the `mail()` and if that is successful, then display the thank you message. – Rasclatt Sep 10 '14 at 05:46
  • Yeah, Thats what Im trying to figure out, the functions to clear all the inputs is giving me trouble, Also, when the error message appears the text size and input size changes to get smaller?? I used CSS to set them to !important but it still just makes them small, then when the error dissapears it returns to normal size – Harry Sep 10 '14 at 05:49
  • How do I reference the user inputs? Is it using somesort of $_POST command? – Harry Sep 10 '14 at 05:52
  • See my edit and yes, you reference the content by `echo $_POST['Email']` or `echo $_POST['Comment']` or what-have-you. – Rasclatt Sep 10 '14 at 05:58
  • Thanks For Your Edit, I implemented and the messsage is sent although the Message Type is empty, I have edited my version in the main post, You might be able to spot where ive messed up, I thought maybe it wasnt posting so I changed that but I dont think that worked, It may have broke more than it fixed xD – Harry Sep 10 '14 at 06:19
  • Your radio buttons were funky. Stuff should all work now...hopefully – Rasclatt Sep 10 '14 at 07:34
  • When I submit the form, if I use the other box and enter something, the message just says: 'Other' ... I thought changing the values, but then it just stopped it from working all together – Harry Sep 10 '14 at 07:50
  • Sorry I messed up and also forgot to mention that the `Type` you'll use as a trigger, the content for `Type` is actually in the `option` field. Also you need to strip tags on the `$POST['comment']` and `$_POST['option']` in the form part. If that part echos the user may have put in malicious code. – Rasclatt Sep 10 '14 at 08:01
  • The type and option part is very confusing, do I just change all the code `Type` to code `Option`? If thats wrong then ill look at your post if you have revised and fixed the issue – Harry Sep 10 '14 at 08:05
  • Also, where do I need to use the strip tags, as far as I know all of them are stripped before the message is sent... Do you mean in every input section, if so where do I put that? Your code now doesnt submit a message type unless I type something in the other box – Harry Sep 10 '14 at 08:11
  • If fixed it on my version. The `Type` you disregard at the time of processing the `$_POST`, it's only used in the form to trigger the `option` text field enable/disable, so when it shows as `Option`, that is fine. See in mine you actually use the data from `option` : `$message .= 'Message Type: '.strip_tags($_POST['option'])` – Rasclatt Sep 10 '14 at 08:12
  • Anytime you are going to display user inputed data to the browser, you strip it, so you have in your form, for instance ` />` if you don't sanitize it there, it has the potential for hackery... – Rasclatt Sep 10 '14 at 08:14
  • What about if I dont use the other radio button, If im using the feedback button the message type is nil because the Type is being ignored, do I change all Type to Option now if im using your version/revision. In relation to your post about sanitizing it straight away, where do I implement that.. Ill do it right away – Harry Sep 10 '14 at 08:16
  • O frig, I forgot, you will have to make a conditional rule when you process so like `$message .= 'Message Type:'; $message .= ($_POST['Type'] !== 'Option')? $_POST['Type']."\n":strip_tags($_POST['option'])."\n";` This is because your `Type` can be contained in either `Type` or `option`. – Rasclatt Sep 10 '14 at 08:21
  • Yeah, I changed all the radio buttons name to option, and that didnt fix it, So when the message is sent, i put that code there? Is that all one line or is it more complicated? – Harry Sep 10 '14 at 08:23
  • I updated it in my edit. The radio buttons should be `name="Type"` and the option text field should stay `name="option"` – Rasclatt Sep 10 '14 at 08:24
  • Well, It closer, although now it works fine when using a radio button, but if you use the other option, it just sends the message type as :'Other'... P.S. Thanks so much for your help, I just hope we can get this to work :) – Harry Sep 10 '14 at 08:28
  • Yeah that's fine. See my edit where if it chooses which input to use on the `$message`. It just ignores the `Option`. That's where the condition happens because the other `Type` buttons contain info after submitted where the `Other` radio is just a trigger for the `option` field which is the place holder for it's info so in the processing it says, if type doesn't equal `Other` use `Type` else use data from that `option` field. – Rasclatt Sep 10 '14 at 08:29
  • Well, Is there a way of it saying what the user typed in the option text box otherwise the box is pointless, because right now it just says: Other – Harry Sep 10 '14 at 08:33
  • If you notice in the `$_POST` array after sumbission, the key labelled `option`, that is where you are getting the data from when `Option` is selected. In that instance, you ignore the `Type` field and use the `option` field instead. When processing before mailing, this is the important part `$message .= ($_POST['Type'] !== 'Option')? $_POST['Type']."\n": strip_tags($_POST['option'])."\n";` – Rasclatt Sep 10 '14 at 08:39
  • Okay, I managed to fix it although it wasnt how you suggested, I just changed this: `($_POST['Type'] !== 'Other')? $_POST['Type']."\n": strip_tags($_POST['option'])."\n";` I basically just changed the lower case other to Other so that it matched the radio button and therfore grabbed the info in the text box... – Harry Sep 10 '14 at 08:43
  • Oh, I wrote it `option` all lower in my form, so yeah they have to match, but you get what it's doing though, hey? Holy cow, I just noticed there are like 50 comments in this thread...I'm surprised a moderator hasn't shut this conversation down!! :D – Rasclatt Sep 10 '14 at 08:45
  • I was thinking the same, all though I dont have enough reputation to start a "chat" it would be a shame to close a thread just for a large amount of assistance... – Harry Sep 10 '14 at 08:58
  • Comments are not for extended discussion; this conversation has been [moved to chat](http://chat.stackoverflow.com/rooms/60955/discussion-on-answer-by-rasclatt-php-and-html-form). – Taryn Sep 10 '14 at 10:19