Re: I need some php help...and then some
| From: | Jeff Gannaway | Date: | Thu, 22 Jun 2000 20:39:19 +0000 |
| Subject: | Re: I need some php help...and then some | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-2727@lists.php.net to get a copy of this message | ||
At 12:44 PM 6/22/00 -0700, J. Lake wrote:
>the site that I am working on requires me to setup
>a mySql database with relatively simple information
>product_id, product_description, cost and perhaps a few others.
Everything I needed to know to get going with PHP and MySQL was found at:
http://www.devshed.com (Developer's Shed)
They have tutorials on MySQL and PHP. Read the MySQL one first as it
explains setting up your database which should be your first step.
>what I need
>is an interface that is orderform like in
>functionality with the exception that when someone enters a product number
>the rest of the form is populated with the data pertaining to the product
>number
Ahhhh..... automatically populating a form. I've never done it, but I
imagine it would involve writing in JavaScript. If you don't want to go
through that hassle, here are my 2 suggestions.
FIRST (AND EASIEST) IDEA:
If the consumer doesn't need to be able to change any of the other form
data, just don't make a blank for it. Create a form that will have inputs
for ProductID, Customer Name, Customer E-Mail, and any other contact info
you want from them.
Have the form point to a PHP script that will query a MySQL database with
the ProductID. Assign the results to variables like:
$ProductName = mysql_query($results, 0, "ProductName");
Finally, have the script insert all those variables into the body of the
e-mail message and then send it off.
SECOND (AND ONLY SLIGHTLY MORE TROUBLESOME) IDEA:
If the customer needs to see and/or edit any of the product info, then you
do have to get it into the form. If I didn't have to do the cool
JavaScript dynamic form stuff, I would make the form a 2-parter. Part one
would ask for the ProductID. When they clicked the SUBMIT button, they
would go to a PHP scrip that would look up the product info in the MySQL
database, assign the values to variables, then populate the form with those
values. This script would then take them to the final step which would
e-mail all the info.
Good luck,
Jeff Gannaway
webmaster@cactusgraphics.com