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 5 of 5
  1. #1
    New Coder
    Join Date
    Mar 2012
    Posts
    20
    Thanks
    3
    Thanked 1 Time in 1 Post

    Basic User Form with Back End System

    Hi guys,

    My knowledge on writing PHP is limited, but I'm past the beginner stage.

    I need to create a form with the following data:-

    First Name:
    Surname:
    Address Line 1:
    Address Line 2:
    City:
    Post Code:
    Country:
    Date of Birth:
    Interests:
    Height (cm):
    Chest Size (inches):
    Waist Size (inches):
    Inside Leg Size (inches):
    Outside Leg Size (inches):
    Shoe Size:
    Female Dress Size:
    Upload Photo:
    Upload CV (pdf, doc):
    Passport Present?: Yes/No
    Driving License Present? Yes/No

    Once this information has been submitted, it will store the info in a MySQL db, and an admin can access a back end system and view/search through candidates. It's basically a simple application form where admin's can search through users.

    Is there a system out there that I could use as a stepping stone? Could someone please guide me?

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,546
    Thanks
    45
    Thanked 259 Times in 256 Posts
    If you google your question (php form store to mysql), you'll find plenty of tutorials on how its done. PLENTY. A form is one of the most basic uses of PHP, and storing to MySQL is only a slight step further. Not saying you'll be a pro overnight, but its really easy.

    The basics are as such: first you have to write proper HTML. You need to wrap everything in a form, tell it where the form goes (action attribute), and how to sent it (post or get via the method attribute). Each element of the form should have a name attribute so you know how to reference it.

    Then on your processing side, you'd reference the form via the appropriate super variable (_GET or _POST), and bam, that's it for getting a form.

    For example:

    PHP Code:
    <form method="post" action="process.php">
    <
    label for="firstName">First Name</label>
    <
    input id="firstName" type="text" name="firstName">
    <
    button type="submit" name="submit">Submit</button>
    </
    form
    process.php:
    PHP Code:
    if (isset($_POST['submit'])) {
    echo 
    $_POST['firstName'];

    A little googling will get you the mySQL side of the answer, and please come back and post additional questions/clarifications you have/need.

  • #3
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,479
    Thanks
    63
    Thanked 538 Times in 525 Posts
    Quote Originally Posted by Keleth View Post
    process.php:
    PHP Code:
    if (isset($_POST['submit'])) { 
    Please tell me you're not serious? - Have you seen my signature and read the topic / watched the video?

    Please don't recommend using the submit button to a learner. If you're going to show them how to use isset, at least do it on a field name that will be sent such as the text field

    Encouraging learners to go by the submit button is not only bad practice but also creating problems for them in the future.
    I can't really think of anything to write here now...

  • #4
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,451
    Thanks
    17
    Thanked 275 Times in 275 Posts
    You can always put this in a form for an isset statement.
    PHP Code:
    <input type="hidden" name="dummy" value="" /> 
    If you have a bunch of pages that submit to the same $_POST, but are different, it's very handy to have one common input for the isset statement.

  • #5
    New Coder
    Join Date
    Mar 2012
    Posts
    20
    Thanks
    3
    Thanked 1 Time in 1 Post
    Thanks kindly for your replies.

    I know slightly more than that. I'm successfully able to capture the users details via POST and save their info into a db (done it yesterday), the only thing I'm stuck on is getting an image/cv uploaded which could then be retrieved in the admin backend.

    Is it best practise to save the image to an upload folder and then reference the path in mysql? How would I know which image references to which user info?

    Thanks so much guys.


  •  

    Posting Permissions

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