• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 313
  • Last Modified:

How to create a php form to accept 3 user inputs

Hello Everyone,

I am looking for some kind of examples or reference, that would let a user/customer to enter a promo code and a zipcode and hit submit,

once the submit button is hit, it should check the promo code with the allowed promo code and if its correct, direct them to the promo page.

The promo code will be in csv file on the server

any suggestions is appreciated.

  • 2
2 Solutions
Ray PaseurCommented:
I think I would want to put all of the data into a MySQL data base.  A database is a "step up" from a CSV file, and can easily be populated from a CSV file.  With a data base you can search and update easily.  This is not nearly as easy with a CSV file.

If you want this done quickly, consider hiring a professional PHP developer.  If you want to use it for your own learning opportunity, consider getting this book.  It's very readable and has great examples.  By the time you've worked through the book you will be able to understand the issues and write the code yourself.  But as a practical matter, you need to know that there are a lot of moving parts and the failure of any one of them can lead to the failure of the entire application.  If you have not programmed before, this would only be a good place to start if there is no economic risk involved (eg: It's a hobby project).

PHP.net has some information on how PHP can process HTML forms.  See "dealing with forms" here:

If you've started writing some code and have specific questions, please post the code and questions, and I'll be glad to try to help.

best regards, ~Ray
Mohamed AbowardaSoftware EngineerCommented:
I agree with Ray, you should really consider using a database instead, it will make the whole job much easier.

The idea is that you will submit your data using a form (POST method).

In PHP (server side) you should be able to read the submitted data by using:

Open in new window

Here is a quick example:

<form action="submit.php" method="post">
Name: <input type="text" name="txtName" />
<input type="submit" />


Open in new window

PHP (submit.php):
echo "Your name is: " . $_POST["txtName"]);

Open in new window

You will also have to know how to deal with MySQL, you can find many tutorials online:

You can also check "Building a Database-Driven Web Site Using PHP and MySQL":
niceoneishereAuthor Commented:
Thanks for the replies, appreciate it
niceoneishereAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now