Jump to content

Search the Community

Showing results for tags 'formfields'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. The program MUST use functions to calculate the cost of the conference, and to calculate the cost of meals. The functions should return the calculated costs back to the main program. I am trying to use checkboxes to for the input.. Im new to all of this trying to get it right.. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html lang="EN" dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <style> body { color:black; font-size:20px; } h1 { color:orange; text-align:center; font-size:30px; } p { font-family:"Times New Roman"; font-size:20px; } </style> <title>MAJOR PROJECT 1 PHP </title> </head> <body> <h1>Nerd Roundup </h1> <form method = "POST" action = "http://localhost/Assignments php class/calculationprogress.php"> <fieldset> <label> Please type your first name: </label> <input type = "text" name = "fName" value = "" /> <br /> <label> Please type your Last name: </label> <input type = "text" name = "lName" value = "" /> <br /> Please type your city: <input type = "text" name = "city" value = "" /> <br /> Please type your State: <input type = "text" name = "state" value = "" /> <br /> Please type your Zipcode: <input type = "text" name = "zipCode" value = "" /> <br /> <label for="other">Anything else you want to add?</label> <textarea id="other" name="other"></textarea><br /> <fieldset> <legend>HOW MANY DAYS</legend> <input type = "checkbox" name = "chkOne" value = "100.OO" /><label>ONE DAY $100.00</label> <input type = "checkbox" name = "chkTwo" value = "175.00" /><label>TWO DAYS $175.00</label> <input type = "checkbox" name = "chkThree" value = "325.00" /><label>THREE DAYS $325.00</label> <br /> <fieldset> <legend>DO YOU WANT THE MEAL PLAN?</legend> <input type = "checkbox" name = "mealPlan" value = "mealPlan" /><label>YES</label> <input type = "checkbox" name = "" value = "no" /><label>NO</label> <br /> <br /> <h1>NERD TRACK</h1> <select name = "track"> <option value = "PROGRAMMING TRACK">PROGRAMMING TRACK</option> <option value = "NETWORKING TRACK">NETWORKING TRACK</option> <option value = "SECURITY TRACK">SECURITY TRACK</option> <option value = "WEB TRACK">WEB TRACK</option> </select> <button type = "submit"> place order </button> </fieldset> </form> </body> </html> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html lang="EN" dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <style> body { background-color:#FF00FF; } h1 { color:orange; text-align:center; } p { font-family:"Times New Roman"; font-size:20px; } h1 {text-align:center; } </style> <title>Assignment3</title> </head> <body> <h1>Personal Information </h1> <?php // define the variables $fName = $_POST["fName"]; $lName = $_POST ["lName"]; $city = $_POST ["city"]; $state = $_POST ["state"]; $zipCode = $_POST["zipCode"]; $other = $_POST ["other"]; $chkOne = $_POST["chkOne"]; $chkTwo = $_POST["chkTwo"]; $chkThree = $_POST["chkThree"]; $mealPlan = $_POST[""]; $confTotal = 0; $no_errors = TRUE; $total = 0; //begin form filter if (filter_has_var(INPUT_POST, "chkOne")){ print "<p>ONE DAY CONFERENCE</p> \n"; $total += filter_input(INPUT_POST, "chkOne"); } if (filter_has_var(INPUT_POST, "chkTwo")){ print "<p>TWO DAY CONFERENCE</p> \n"; $total += filter_input(INPUT_POST, "chkTwo"); } if (filter_has_var(INPUT_POST, "chkThree")){ print "<p>THREE DAY CONFERENCE</p> \n"; $total += filter_input(INPUT_POST, "chkThree"); } //end $total if (filter_has_var(INPUT_POST, "mealPlan")){ } if (filter_has_var(INPUT_POST, "noFood")){ } // do they want the meal plan $track = filter_input(INPUT_POST, "track"); // what conference track are they on if(empty($fName)) { $no_errors = FALSE; echo '***FIRST NAME FIELD REQUIRED***** <br />' ; } //get users first name if(empty($lName)) { $no_errors = FALSE; echo '****LAST NAME FIELD REQUIRED***** <br /> '; } // get users last name if(empty($city)) { $no_errors = FALSE; echo '****CITY FIELD REQUIRED***** <br /> '; } //get user city if(empty($state)) { $no_errors = FALSE; echo '***STATE NAME FIELD REQUIRED***** <br /> '; } //get user state if(empty($zipCode)) { $no_errors = FALSE; echo '****ZIPCODE FIELD REQUIRED***** <br /> '; } //get user zip code if(empty($other)) { $no_errors = FALSE; echo '****TEXT FIELD REQUIRED***** <br /> '; } //get user additional comments if ($no_errors == FALSE) { echo "<br> <a href='major1progress.html'>Go back to form</a>"; } // check the fields are all filled if not direct back to form page //beging function calculateCost function calculateCost() global $total; $total = filter_input (INPUT_POST, "total"); $mealPlan = filter_input (INPUT_POST, "mealPlan"); IF (! filter_has_var (INPUT_POST, "mealPlan" )){ && $total =="100" ,$confTotal = $total+= 50; } else if ($total=="175"){ $confTotal = $total +=75; } else if ($total =="225"){$confTotal = $total +=100; } //end function cacluclateCost //end if //1 to 1000 $confId = rand(1,1000); //generate conf id number if ($no_errors == TRUE) { print " <p> $fName $lName, <br />you have registered for Nerd Roundup 2013<br /> your planned track is $track<br /> <br /> You choose -confDay<br /> with -mPlan<br /> The total cost is: \$$confTotal <br /> I hear the climate around $zipCode is great this time of year. <br /> Please make sure to bring cash, or your credit card to pay for the conference on the first day<br /> Your additional comments are as follows: $other <br /> </p> <p>Your Nerd Roundup confirmation number is $confId .</p> <br /> \n"; } //check and see is the form filled out if it is then print stuff ?> </body> </html> //beging function calculateCost function calculateCost() global $total; $total = filter_input (INPUT_POST, "total"); $mealPlan = filter_input (INPUT_POST, "mealPlan"); IF (! filter_has_var (INPUT_POST, "mealPlan" )){ && $total =="100" ,$confTotal = $total+= 50; } else if ($total=="175"){ $confTotal = $total +=75; } else if ($total =="225"){$confTotal = $total +=100; } //end function cacluclateCost
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.