View Full Version : First PHP form - Need guidance

01-09-2012, 03:29 AM
Hey guys
New to PHP and programming in general. I am writing my first PHP form to spit out some "instant" answers based on user input. Basically, i want the form choices to change automatically(without page reload) depending on the choices made before it . I do not know AJAX or JS but if anyone is willing to help i would greatly appreciate it! Thanks in advance.

01-09-2012, 03:40 AM
Not enough information ... we have no idea what your form is about, or what it's supposed to do.

I would say you can start here and find one closest to what you want.

01-09-2012, 03:49 AM
Hey mlseim,
You actually helped me with my first problem so you have seen my form lol sorrry for not posting the first time though, it is below.

Basically, i will have 2 forms and one will show if $outside isset and the other will show if $inside isset but i do not want the user to have to reload the page. Does this makes sense? Thanks a million for your help.

<?php if($_POST['in_or_out'] == "inside" ) { $inside = $_POST['in_or_out']; } elseif($_POST['in_or_out'] == "outside" ) {$outside = $_POST['in_or_out']; }?>

<h4> Please answer the following questions to receive a hardware recommendation or Fill out the contact us form for more complex questions</h4>
<?php if(!isset($_POST["form"])) { ?>
<form action="<?php echo htmlentities($_SERVER['PHP_SELF']) ?>" method="post" name="form">
<p>Indoor or Outdoor : <select name='in_or_out'><option value=''>Select one</option><option name="inside" <?php if(isset($inside)){echo "selected"; }?> value="inside">Inside</option><option name="outside" <?php if(isset($outside)) {echo "selected" ; } ?> value="outside">Outside</option>
<?php if(isset($outside)) { ?>
<select name="application" >
<option value="opt1">opt1</option>
<option value="opt2">opt2</option>
<option value="opt3">opt3</option>
<?php } elseif(isset($inside)) { ?>
<select name="application" >
<option value="opt1">opt1</option>
<option value="opt2">opt2</option>
<?php } ?>

<br />
<input type="submit" name="submit" value="Submit">

<?php } ?>

01-09-2012, 04:00 AM
I found the info on the "chained select boxes" but i dont really get it :/

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum