Jump to content

Search the Community

Showing results for tags 'php sticky'.

  • 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. Hello all! I am currently taking a PHP/SQL class and I am stumped on one of my assignments. We are building a form and I have a list of requirements for this step of the project. They are: 1. Submits the form to itself. 2. Displays the Alien Abduction Form. Remember, your PHP script should be setup to display this page - do not use a separate HTML form. You should be able to copy and paste your code from the html form lab into a function. 3. Make all the form fields sticky. If there is an error in filling out the form no input data should be lost. It should redisplay the information entered (including radio buttons)along with any appropriate error messages. 4. Display error messages on the html form (don't take the user to a separate error page). 5. Display a confirmation page once all information has been filled in and submitted. At this point the form should not redisplay. I am at the point where I need to make the form fields sticky. I completed an exercise with a MPG calculator to make the fields sticky and that exercise will run correctly from my server. So my logic is the code that worked for one field would work in another. But, when I place the code in my assignment, the php code shows in the browser. I have looked at php.net for help with what would cause this and a few other forums but I can't seem to find this happening to anyone else. I have attached a screenshot of what I am getting along with the code. Thanks in advanced for any help and advice. <?php ini_set('display_errors',1); error_reporting(E_ALL); $page_title = 'Alien Abduction Form'; include ('header.html'); // Create post variables if($_SERVER['REQUEST_METHOD'] == 'POST') { $firstname = $_POST['fname']; $lastname = $_POST['lname']; $when = $_POST['when']; $length = $_POST['length']; $see = $_POST['see']; $look= $_POST['look']; $do= $_POST['do']; $seen= $_POST['seen']; $comments= $_POST['comments']; $email = $_POST['email']; validation(); }; // Create functions to validate first name, last name, email and if they saw fluffy function validation () { if (!empty($_POST['fname'])) { $firstname = $_POST['fname']; $firstnameerror = NULL; echo '<p>Sorry, you must give your First Name!</p>';} if (!empty($_POST['lname'])) { $lastname = $_POST['lname']; } else { $lastname = NULL; echo '<p>Sorry, you must give your Last Name!</p>'; } if (!empty($_POST['email'])) { $email = $_POST['email']; } else { $email = NULL; echo '<p>Sorry, you must provide an email address!</p>'; } if (isset($_POST['seen'])) { $seen = $_POST['seen']; } elseif ($seen == "no") { echo '<p>Darn, we really miss him!</p>'; } elseif ($seen = NULL) { echo '<p>Sorry you have not told us if you saw Fluffy or not!</p>' ; } else { $seen = NULL ; echo '<p>Sorry, you did not tell us if you saw Fluffy or not!</p>'; }} // create confirmation function function confirmation () { if ($lastname && $firstname && $email && $seen == true) { echo "<p>Thanks for submitting the form <emp><b>$firstname $lastname</b></emp>!</p> <p>This is what we got: <br> You were abducted: <b> $when</b> for <b>$length</b></p> <p>You saw <b>$see</b> aliens that appeared <b>$look</b></p> <p>You answered: <b>$seen</b> in regards to seeing Fluffy.</p> <p> Here are your additional comments: <br> $comments</p> \n"; } else { validation() ;} } echo '<p>Share your story of alien abduction:</p> <p>Please note, anything with an asertisk (<b>*</b>) is required.</p> <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="abductreport"> <!-- First Name Input --!> <label for="fname">First Name:<b>*</b></label> <input type="text" name="fname" id="fname" placeholder="First Name" value="<?php echo $fname ?>"><br> <label for="lname">Last Name:<b>*</b></label> <input type="text" name="lname" id="lname" placeholder="Last Name"><br> <label for="email">What is your Email address?<b>*</b></label> <input type="email" name="email" id="email" placeholder="Email"><br> <label for="when">When did it happen?</label> <input type="date" name="when" id="when"><br> <label for="length">How long were you gone?</label> <input type="text" name="length" id="length" placeholder="days, months, years?"><br> <label for="see">How many did you see?</label> <input type="number" name="see" id="see" placeholder="Enter a Number"><br> <label for="look">Describe them:</label> <input type="text" name="look" id="look" placeholder="What was their appearance?"><br> <label for="do">What did they do you to?</label> <input type="text" name="do" id="do" placeholder="Describe what they did"><br> Have you seen my dog fluffy?<b>*</b> <input type="radio" name="seen" id="yes" value="yes">Yes <input type="radio" name="seen" id="no" value="no">No<br> <img src="fluffy.jpg" alt="Have you seen Fluffy?"><br> <label for="comments">Anything else you want to Add?</label> <textarea rows="3" cols="50" name="comments" id="comments" placeholder="Your comments..."></textarea><br><br> <input type="submit" value="Report Abduction"> </form>' ?>'
×
×
  • 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.