Jump to content

Johnnygrr

New Members
  • Posts

    1
  • Joined

  • Last visited

Johnnygrr's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi All, Noob here - I created the questionaire below and associated PHP file using ChatGPT & video tutorials - i've got the form looking just how i like it, but cannot get the blooming thing to submit! It just shows the error message every single time. HTML Script <!DOCTYPE html> <html> <head> <link href="https://fonts.googleapis.com/css2?family=Oswald&display=swap" rel="stylesheet"> <style> body { font-family: 'Oswald', sans-serif; } button { font-size: 14px; width: 80px; height: 31px; background-color: #D3413F; color: white; } label { font-size: 18px; font-weight: bold; display: inline-block; } input[type="text"] { width: 55%; font-family: 'Oswald', sans-serif; } textarea { width: 80%; height: 100px; font-family: 'Oswald', sans-serif; } #other_challenge_text { display: inline-block; margin-left: 10px; } </style> <script> function showNext(current, next) { document.getElementById(current).style.display = "none"; document.getElementById(next).style.display = "block"; } function showBack(current, previous) { document.getElementById(current).style.display = "none"; document.getElementById(previous).style.display = "block"; } function showOtherBox() { var otherBox = document.getElementById("other_challenge_text"); if(document.getElementById("other_challenge_radio").checked) { otherBox.style.display = "block"; } else { otherBox.style.display = "none"; } } </script> </head> <body> <form action="caa_application.php" method="post"> <div id="question_1"> <label for="challenge">What's your biggest challenge right now regarding acquiring new customers?</label> <br><br> <input type="radio" name="challenge" value="Not enough leads"> Not enough leads <br> <input type="radio" name="challenge" value="Not closing the leads we've got"> Not closing the leads we've got <br> <input type="radio" name="challenge" value="Not enough growth from our current accounts"> Not enough growth from our current accounts <br> <input type="radio" name="challenge" value="Other" id="other_challenge_radio" onclick="showOtherBox()"> Other <div id="other_challenge_text" style="display: none;"> <input type="text" name="other_challenge" id="other_challenge"> </div> <br><br> <button type="button" id="next_question_1" onclick="showNext('question_1', 'question_2')">Next</button> </div> <div id="question_2" style="display:none"> <label for="team_structure">Can you tell me more about your current sales and marketing team structure?</label> <br><br> <textarea name="team_structure" id="team_structure" placeholder="Who is responsible for selling, marketing and account management? Bonus points for linkedin profiles!"></textarea> <br><br> <button type="button" id="back_question_2" onclick="showBack('question_2', 'question_1')">Back</button> <button type="button" id="next_question_2" onclick="showNext('question_2', 'question_3')">Next</button> </div> <div id="question_3" style="display:none"> <label for="average_order_value">What is your typical average order value?</label> <br><br> <input type="text" name="average_order_value" id="average_order_value" placeholder="Roughly, how much are your average orders worth?"> <br><br> <button type="button" id="back_question_3" onclick="showBack('question_3', 'question_2')">Back</button> <button type="button" id="next_question_3" onclick="showNext('question_3', 'question_4')">Next</button> </div> <div id="question_4" style="display:none"> <label for="average_close_time">How long does it take to close an order on average?</label> <br><br> <input type="text" name="average_close_time" id="average_close_time" placeholder="From start to finish - Days, Weeks or Months?"> <br><br> <button type="button" id="back_question_4" onclick="showBack('question_4', 'question_3')">Back</button> <button type="button" id="next_question_4" onclick="showNext('question_4', 'question_5')">Next</button> </div> <div id="question_5" style="display:none"> <label for="name">Great, thanks for sharing this. Now, a little about you!</label> <br> <p>Please enter your first name:</p> <input type="text" name="first_name" id="first_name" placeholder="First Name"> <br> <p>Please enter your last name:</p> <input type="text" name="last_name" id="last_name" placeholder="Last Name"> <br><br> <button type="button" id="back_question_5" onclick="showBack('question_5', 'question_4')">Back</button> <button type="button" id="next_question_5" onclick="showNext('question_5', 'question_6')">Next</button> </div> <div id="question_6" style="display:none"> <label for="company_name">What company do you work for?</label> <br><br> <input type="text" name="company_name" id="company_name" placeholder="Enter your company name"> <br><br> <button type="button" id="back_question_6" onclick="showBack('question_6', 'question_5')">Back</button> <button type="button" id="next_question_6" onclick="showNext('question_6','question_7')">Next</button> </div> <div id="question_7" style="display:none"> <label for="cohort">Which cohort are you applying for?</label> <br><br> <input type="radio" name="cohort" value="Merseyside September 2023"> Merseyside September 2023 <br> <input type="radio" name="cohort" value="Yorkshire September 2023"> Yorkshire September 2023 <br><br> <button type="button" id="back_question_7" onclick="showBack('question_7', 'question_6')">Back</button> <button type="button" id="next_question_7" onclick="showNext('question_7', 'question_8')">Next</button> </div> <div id="question_8" style="display:none"> <label for="success_looks_like">It's lovely to meet you, can you tell me what success looks like to you?</label> <br><br> <textarea name="success_looks_like" id="success_looks_like" placeholder="What would you want to see after 3, 6, 12 months to make you sure you made the right decision in working with us?"></textarea> <br><br> <button type="button" id="back_question_8" onclick="showBack('question_8', 'question_7')">Back</button> <button type="button" id="next_question_8" onclick="showNext('question_8', 'question_9')">Next</button> </div> <div id="question_9" style="display:none"> <label for="extra_info">Is there anything else you think we should know about you, your business or your customers at this stage?</label> <br><br> <input type="text" name="extra_info" id="extra_info" placeholder="Anything else you would like to share?"> <br><br> <button type="button" id="back_question_9" onclick="showBack('question_9', 'question_8')">Back</button> <button type="submit">Submit</button> </div> </form> </body> </html> PHP Script <?php if(isset($_POST['submit'])) { $to = "jgriffiths100@gmail.com"; $challenge = $_POST['challenge']; $other_challenge = $_POST['other_challenge']; $team_structure = $_POST['team_structure']; $average_order_value = $_POST['average_order_value']; $average_close_time = $_POST['average_close_time']; $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $company_name = $_POST['company_name']; $cohort = $_POST ['cohort']; $success_looks_like = $_POST['success_looks_like']; $extra_info = $_POST['extra_info']; $headers = "From: jgriffiths100@gmail.com" . "\r\n"; $message = "Application for The Customer Acquisition Accelerator\n\n"; $message .= "Biggest Challenge: " . $challenge . "\n"; mail($to, "CAA Application", $message, $headers); echo "Thank you, your application to join The Customer Acquisition Accelerator has been submitted and a member of the team will get back to you within the next 2 working days."; } else { echo "Error: Form has not been submitted. Please fill out the form and submit it again."; } ?> Mail is definitely running on the server. Anyone any ideas?
×
×
  • 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.