Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define('THIS_PAGE', basename($_SERVER['PHP_SELF']));//shows webroot
- if(isset($_POST['submit3'])){ //proces form - catches the post info when submit clicked
- $arr = $_POST['sundae'];
- $lastElement = array_pop($arr);
- if ($arr == ""){$myReturn = "stuff"; echo $myReturn;}
- else
- {$myReturn = "<span style="color:red; font-weight: bold">You have selected: " . implode(', ',$arr)." and ".$lastElement;
- $myReturn .= "</span> <br />";
- $myReturn .= '<input type="button" value="Reload page" onclick="reloadPage()" >';
- echo $myReturn;}
- }else{// show the form if no posties
- echo
- '
- <form action="myTest.php" method ="post">
- Select a size:<br />
- <input type="checkbox" name="sundae[]" value="One Scoop"> One Scoop<br />
- <input type="checkbox" name="sundae[]" value="Two Scoops"> Two Scoops<br />
- <input type="checkbox" name="sundae[]" value="Three Scoops"> Three Scoops<br />
- <hr ><br />
- Select a flavor:<br />
- <input type="checkbox" name="sundae[]" value="Chocolate">Chocolate<br />
- <input type="checkbox" name="sundae[]" value="Coffee">Coffee<br />
- <input type="checkbox" name="sundae[]" value="Double Fudge">Double Fudge<br />
- <hr ><br />
- Select your Toppings:<br />
- <input type="checkbox" name="sundae[]" value="Applesauce">Applesauce<br />
- <input type="checkbox" name="sundae[]" value="Blueberries">Blueberries<br />
- <input type="checkbox" name="sundae[]" value="Bubblegum">Bubblegum<br />
- <input type="checkbox" name="sundae[]" value="Caramel">Caramel<br />
- <input type="checkbox" name="sundae[]" value="Hot Fudge">Hot Fudge<br />
- <input type="checkbox" name="sundae[]" value="Gummy Bears">Gummy Bears<br />
- Select a Whip:<br />
- <input type="checkbox" name="sundae[]" value="Double Whipped Cream">Double Whipped Cream<br />
- <input type="checkbox" name="sundae[]" value="Marishino Cherry">Vanilla Whipped Cream<br />
- <input type="checkbox" name="sundae[]" value="Whipped Cream">Whipped Cream<br />
- <hr ><br />
- Select a Cherry:<br />
- <input type="checkbox" name="sundae[]" value="Black Cherry">Black Cherry<br />
- <input type="checkbox" name="sundae[]" value="Frozen Lake Cherry">Frozen Lake Cherry<br />
- <input type="checkbox" name="sundae[]" value="Marishino Cherry">Marishino Cherry<br />
- <br />
- <hr ><br />
- Wopuld you like to add one "waffer-thin" mint? (No charge)<br />
- <input type="checkbox" name="sundae[]" value="Wafer-Thin Mint">Yes<br />
- <br />
- <input type="submit" name="submit3" >
- </form>
- ';
- }
- ?>
- else
- {
- //> 1 because we already popped the last element
- if (count($arr) > 1) $lastElement = " and " . $lastElement;
- $myReturn = "<span style="color:red; font-weight: bold">You have selected: " . implode(', ',$arr).$lastElement;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement