Jump to content

Recommended Posts

Posted

Hi everyone,

 

I am trying to add a conditional if statement to a checkbox in an html form, so that when the user checks the box, the a new set of form elements appear below it.

 

I created the new form elements in a seperate file, and planned on using the include command, so something like:

 

If ('kick start' == "yes"

{ include ('kickstart.html');}

 

the html check box code is

Kick Start

 

nothing happens though when i click the checkbox.

 

Any thoughts?

Posted

i checked out the link, but what i need is that when a user checks a box a whole new section of form appears, with text fields and areas etc.

 

I dont know much about JS either, so if anyone knows where i might help or a tutorial on this or with PHP would be very much appreciated.

 

I found a source with what looked like it could do what i want, but the page threw a 500 internal server error when loading the it. the new code if anyone maybe able to shed some light is:

 

<?php

//Defining checkbox variable

$kick_start = 'unchecked';

 

if(isset($_POST['continue'])) // the continue button to execute the following

{

if ?(isset($_POST['kick_start']))

{

$kick_start = $_POST['kick_start'];

if ($kick_start == 'yes')

{ include("kick_start_form.html");

}

}

}

?>

 

Many thanks everyone

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...