Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

How do I enable another page to open if checkbox is checked

$
0
0

I am designing a site where, if the student is under 19, they get transferred to the client page. Where am I going wrong as it's not working.

 

Should I use a checkbox or a radiobox?

 

Many thanks

 

This is my HTML code for the :

 

<form name ="contactform" action="send_form_email.php" method="post">    

<br>
<table width="900" border="0" align="center" cellpadding="3" cellspacing="0">
<div align="center"><span class="style18">Student Enquiry Form</span></div>

  <tr>
    <td></td> <td align="left"> <input type="radio" class="radio" rel="clientdetails.php">
    <?php  if($("input[@name=under19]:checked").val()=="private")
{
attr("action"clientdetails.php");
?>php

    <span class="style8"> The student is under 19</span></td>
  </tr>

 

 

This is the PHP code:

 

<?php

if(isset($_POST['email'])) {    
    // CHANGE THE TWO LINES BELOW
        $email_to = "ftnby@yahoo.com";
        $email_subject = "Tuition enquiry form";
   }
function died($error) {
   // your error code can go here
        echo "We're sorry, but there's errors found with the form you submitted.<br /><br />";
        echo $error."<br /><br />";
        echo "Please go back and fix these errors.<br /><br />";

    }
    
// your required code can go here
   if (empty($_POST["your_first_name"]))
    {$nameErr = "Name is required";}
  else
    {$name = test_input($_POST["name"]);}
    
  if (empty($_POST["your_surname"]))
    {$nameErr = "Name is required";}
  else
    {$name = test_input($_POST["name"]);}

  if (empty($_POST["email"]))
    {$emailErr = "Email is required";}
  else
    {$email = test_input($_POST["email"]);}

  if (empty($_POST["home_address"]))
    {$nameErr = "Address is required";}
  else
    {$name = test_input($_POST["address"]);}

  if (empty($_POST["post_code"]))
    {$nameErr = "Post code is required";}
  else
    {$name = test_input($_POST["post_code"]);}

  if (empty($_POST["landline_number"]))
    {$numberErr = "Please provide a Landline or Mobile number";}
  else
    {$number = test_input($_POST["comment"]);}

  if (empty($_POST["students_first_name"]))
    {$nameErr = "Name is required";}
  else
    {$name = test_input($_POST["name"]);}
    
  if (empty($_POST["students_surname"]))
    {$nameErr = "Name is required";}
  else
    {$name = test_input($_POST["name"]);}

  if (empty($_POST["subject_required"]))
    {$nameErr = "Subject is required";}
  else
    {$name = test_input($_POST["name"]);}

  if (empty($_POST["level_of_study"]))
    {$nameErr = "Level_of_Study is required";}
  else
    {$name = test_input($_POST["name"]);}
    
  


Viewing all articles
Browse latest Browse all 13200

Trending Articles