Re: I need some php help...and then some

From: Date: Thu, 22 Jun 2000 23:41:45 +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-2722@lists.php.net to get a copy of this message
This is more of a method than code, but here goes Set up your product table in mysql with fields like you described below (product_id, etc.). Name all elements of your form like 'dataset[myfield]'. This way you can handle all the form data as an array (this comes in handy later). Set up the form with the product number textbox at the top with a 'Select' button next to it. The form submits to itself, so you can handle the button push at the top and execute a mysql query that fills in an array that will then populate the form. The other button on the form (submit_data) is also handled at the top. ex. <? mysql_pconnect ("host", "user", "pass"); mysql_select_db ("yourdb"); if ($select_product_id) { // fill in the form $query = "select * from your_product_table where product_id='$dataset[product_id]'"; $result = mysql_query ($query); $dataset = mysql_fetch_array ($result); // fill in the $dataset array } elseif ($submit_data) { // handle the data submission // send a mail to the company $message = "Hi! We want product id $dataset[product_id] from you now!"; $message .= "\n\nYours truly,"; $message .= "\nYour pal."; mail (..., $message); // reply goes here } echo "<form action='$PHP_SELF' method=POST>"; echo "Product Id: <input type=text name=dataset[product_id] value='$dataset[product_id]'>"; echo "<input type=select name=select_product_id value='Select...'>"; echo "<br>"; echo "Product Description: <input type=text name=dataset[product_description] value='$dataset[product_description]'>"; echo "<BR>"; // etc. echo "<input type=submit name=submit_data value='Update...'>"; ?> -Ryan On Thu, Jun 22, 2000 at 12:44:13PM -0700, J. Lake wrote: > Ok, heres the deal and I'll try to be as specific as I > can. I doing some webdesign right now and I've undertaken a project that I'm > a bit incapable of at the > moment. > > 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. 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 and then after the form is populated with all of the particular items > a person is ordering it can be emailed to the company > (that part I'm ok with) > > I'm certain that it is entirely feasible, I just don't know > how and where to start. I'm currently in the very early stages of learning > php ...if only I had more time or programming experience...but none the less > if anyone has any ideas or suggestions I certainly would appreciate it. > > Regards, > J. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net ---end quoted text---

« previous php.general (#2722) next »