Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts

    First PHP form - Need guidance

    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.

  • #2
    Master Coder mlseim's Avatar
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,389
    Thanks
    8
    Thanked 1,077 Times in 1,068 Posts
    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.
    http://www.noupe.com/css/47-excellen...css-forms.html

  • #3
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts
    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 Code:
    <?php if($_POST['in_or_out'] == "inside" ) { $inside $_POST['in_or_out']; } elseif($_POST['in_or_out'] == "outside" ) {$outside $_POST['in_or_out']; }?>
    </head>

    <body>
    <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>
    </select>
    </p>
    <?php if(isset($outside)) { ?>
    <select name="application" >
    <option value="opt1">opt1</option>
    <option value="opt2">opt2</option>
    <option value="opt3">opt3</option>
    </select>
    <?php } elseif(isset($inside)) { ?>
    <select name="application" >
    <option value="opt1">opt1</option>
    <option value="opt2">opt2</option>
    </select>
    <?php ?> 

    <br /> 
    <input type="submit" name="submit" value="Submit">
    </form>
     
    <?php ?>
    </body>
    </html>

  • #4
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts
    I found the info on the "chained select boxes" but i dont really get it :/


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •