how to display the items/fields in the same page

Problems with the Windows version of XAMPP, questions, comments, and anything related.

how to display the items/fields in the same page

Postby warrentolentino » 13. June 2018 15:11

i am new to php. my code is below and i want to display the variables/fields that i have on the page. for example i want to display the results of the name, drop down list item, radio button, and the check box. i tried this:

Code: Select all
$myName = $_GET["myName"];


but it will not work. please advise. thank you.

Code: Select all
<!--CISS225 Warren Tolentino-->
<!--Web Design PHP and MySQL-->
<?php
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Assignment 02: Bad Code</title>
    <style>      
    body {background-color:lightsalmon;
         color:#333;
         font-weight:bold;
         font-family:calibri;}      
            
        h1,h2,h3,h4 {color:maroon;}
    </style>
</head>
<body>
    <form method="get" action="form.php">
     <p><label>Name: <input type="text" name="myName"</label></p>
        
     <p>what is your favorite ice cream:
      <select name="dlIceCream">
       <option value="01">Mango</option>
       <option value="02">Strawberry</option>
       <option value="03">Chocolate</option>
       <option value="04">Vanilla</option>
       <option value="05">Cherry</option>
       <option value="06">Blueberry</option>
       <option value="07">Cookies n Cream</option>
       <option value="08">Peach</option>
       <option value="09">Banana</option>
       <option value="10">Avocado</option>
       </select>
      </p>
   
     <fieldset><legend>what is your favorite season</legend>
       <input id="rbSummer" type="radio" required />
       <label for="rbSummer">Summer</label>
       <input id="rbFall" type="radio" />
       <label for="RBFall">Fall</label>
       <input id="rbSpring" type="radio" />
       <label for="rbSpring">Spring</label>
     </fieldset>
     <br>
     <fieldset><legend>what is your favorite hobby</legend>
      <input type="checkbox" name="cb01" value="computer"><label>Computer</label>
       <input type="checkbox" name="cb02" value="sport"><label>Sports</label>
       <input id="rbWinter" type="radio" />
       <label for="rbWinter">Winter</label>
      <input type="checkbox" name="cb03" value="garden"><label>Gardening</label><br>
      <input type="checkbox" name="cb04" value="cook"><label>Cooking</label>
      <input type="checkbox" name="cb05" value="read"><label>Reading</label>
      <input type="checkbox" name="cb06" value="paint"><label>Painting</label><br>
     </fieldset>
    <p>
      <!-- <input type="button" value="submit" /> -->
      <!-- <input type="reset"  value="reset" /> -->
    </p>
     </form>
    <!--<a href="index.php">Back to Index</a> -->
   
    <?php
      if (!isset($_GET["submit"]))
     {
       ?>
       <form>
      <input type="submit" value="submit" name="submit" />
      <input type="reset"  value="reset" />
       </form>
       <?php
      }
     else
     {
      ?>
       $myName = $_GET["myName"];
        <h2>Form was submitted</h2>
       <?php
      }
     ?>
</body>
</html>
warrentolentino
 
Posts: 5
Joined: 04. March 2014 21:22
Operating System: windows 7

Re: how to display the items/fields in the same page

Postby Nobbie » 13. June 2018 16:25

Nobbie
 
Posts: 13182
Joined: 09. March 2008 13:04

Re: how to display the items/fields in the same page

Postby warrentolentino » 13. June 2018 20:55

thanks.
warrentolentino
 
Posts: 5
Joined: 04. March 2014 21:22
Operating System: windows 7


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 132 guests