I'm finding some information here and there about $PHP_SELF but never specific to the question I have. I'm not sure if I'm going about this right, but I'm using a form for user input, specifically a registration page - and I'd rather only have one page the user has to fill out instead of 2 or more
- so -
Within that form is another form, which is a dropdown box that consists of 2 choices. What I'm trying to do is depending on the answer of the dropdown box, have the page display a set of questions specific to an answer that is given within the dropdown box values, but I'm trying to have this new set of questions display on the same page, possibly without refreshing it, so that the information the user has already typed in the first form (that the dropdown form is embedded inside of) is not lost.
I know it'd probably be easier with javascript, or at least it seems like javascript's style, or to do this on 2 seperate pages, but I'm trying to get php down and I'm fairly convinced there's a way to do this on one page.
when I use $PHP_SELF and select a value in the dropdown box, it doesn't even refresh to the same page, the page just kinda sits there. Can anyone show me what I'm doing wrong, or point me in the right direction?
<html>
<form method="post" action="processRegistration.php">
//several tables with text fields for user to enter information in
<form method="post" action="<?php echo $PHP_SELF;?>">
//dropdown box w/yes and no for options
</form>
<?php
$problem = $_POST['problem'];
echo $statement;
switch($statement)
case "Yes":
//echo question set for yes
break;
case "No":
//echo question set for no
break;
default:
//echo unforseen error message
break;
?>
<input type="submit" value="Submit Registration/>
//closing stuff </form></html> etc
I know most of that was html but the part I think is the problem is being written in php - and this is for a site mainly written in php and mysql, this just happens to be an html form (because I try to seperate one language from another) used in this site - specifically being called by a .php page, and I've never attempted to make a form quite like this one before - usually just straightforward fill it out n click stuff but never on the same page based off another dropdown menu.
any help is much appreciated - thanx!