...

View Full Version : Basic User Form with Back End System



dnbmadness
07-31-2012, 10:08 AM
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?

Keleth
07-31-2012, 02:56 PM
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:


<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:

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.

tangoforce
07-31-2012, 08:51 PM
process.php:

if (isset($_POST['submit'])) {


:eek: 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 :thumbsup:

Encouraging learners to go by the submit button is not only bad practice but also creating problems for them in the future.

DrDOS
07-31-2012, 09:40 PM
You can always put this in a form for an isset statement.


<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.

dnbmadness
08-01-2012, 09:41 AM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum