-
Posts
895 -
Joined
-
Last visited
-
Days Won
1
Everything posted by phppup
-
Beginning to see where this might work. But if my INITIAL default is ZERO, do i change the code to: $selected=0 Or does =1 get the code moving?
-
There are MANY, but let's work with CUTLETS. (i'd list them all but it's lunchtime and we'd all get hungry.. LOL) By the way, I want to thank you all for your patience. I do appreciate it. [Can you comment on MargateSteve's code. It seems short and concise, but seems to have an unknown variable.]
-
Not sure WHERE TO PLACE the code now.
-
ALSO, with the above code, how would I select MY default value, so that an item that had no selection would be recorded as the default.
-
OKAY! Now I'm beginning to understand how PHP could have made my life easier. However, I am WAY beyond that. All the code has already been handwritten and the form has already submitted data INTO the DB. Now I have generated the identical form that comes up when I make a request for data FROM the DB. My difficulty at this point is that no VALUES are being placed in the form. ALL the data is generated INTo the database with HTML dropdown menus. I want it to get the info from the database so that the option that is saved in the database will be new default when the page is loaded, and will SHOW in the form. If I don't change it to the previous info it will update the database with the default option rather then the actual option.
-
This looks like it's establishing a PHP dropdown menu, not takiing the data from my DB, or placing it in my HTML dropdown (the same one that submitted it) from my HTML form. I can change the form to PHP, but I prefer the HTML dropdown for design purposes.
-
I'll do it manually (as long as it works) but I don't know what to write. How can I do it dynamically if every item has a different field name and I need the SUBMITTED value for EVERY item to become the NEW DEFAULT with the intention of the form being used to update data. example: customer ordered 1 chicken cutlet and now wants 3 instead. I want to view the original order, verify that ONE was ordered, change the selection to 3, and UPDATe the record. If this cannot be handled in one page, I will gladly do it it two steps to avoid complications
-
I've got this in my query: $result = mysql_query("SELECT * FROM pass WHERE id = 4 ") or die(mysql_error()); $row = mysql_fetch_array( $result ); And inside my form: echo "cutlets <select name='chixcutlet' value=''> "; echo " <option value='0.00' selected> --- </option>"; echo " <option value='1.00'> 1 </option>"; echo " <option value='2.00'> 2 </option>"; echo " <option value='3.00'> 3 </option>"; echo " </select>"; My form comes up fine, but no values are extracted from the DB. I want it to get the info from the database so that the option that is saved in the database will be new default when the page is loaded. If I don't change it to the previous info it will update the database with the default option rather then the actual option.
-
I'm trying to pull up an identical form after submission by using its "id" and ECHO for the form lines. Question: What is the correct approach for ECHOing an HTML dropdown that is written as: <select name='chixcutlet' value='' > <option value='0.00' selected> --- </option> <option value='1.00'> 1 </option> <option value='2.00'> 2 </option> <option value='3.00'> 3 </option> </select> I want it to get the info from the database so that the option that is saved in the database will be new default when the page is loaded. If I don't change it to the previous info it will update the database with the default option rather then the actual option.
-
THANKS.... i'll keep this open and let you know how it works out.
-
So I would have: $record_id = (isset($_POST['record_id'])) ? $_POST['record_id'] : ''; //check for $record_id emptiness if(!empty($record_id)) { "SELECT * FROM mytable WHERE id = $record_id " } Is that correct?? Am I missing any brackets or braces??
-
Just storing simple numbers, nothing >20 and only some are in intervals of .5 (ie: for certain items 1.0, 1.5, 2.0, 2.5 etc., and others just whole numbers: 1,2,3,4,5,etc)
-
I am able to view record numbers 22, 84, and 203 by exectuing my PHP script with the correct record ID. However, what I really want to do is have a simple form whereby I can input the desired record number and have it upload the data for me. I imagine it would look something like this: "SELECT * FROM mytable WHERE id = specified_record" but need a bit of guidance to get the HTML input fields 'name' into the PHP request.
-
YES, i read that. But is there a method that's considered BEST from a structure or behavioral standpoint?
-
Ohhhhhhh, rest assured, I AM!!!!! Just noticed that certain numeric inputs in the database are shown as 3.00 and others as 3. Then I realized some fields were SMALLINT and others were VARCHAR. I try not to post unless I'm really stumped, or short of time (because of the HOURS LOST chasing wrong solutions... LOL. Nonetheless, I am enjoying the process. Even at 3AM!
-
I was gonna try something like that, but i GREATLY appreciate your response. As a newbie it's VERY reassuring to know that something should work BEFORE attempting it. Now if I run into trouble, I can at least feel confident that the effort is worthwhile, rather than the concept being impossible. Thanks
-
My form has 40 fields, and I want to re-generate it to be reviewed as it was when submitted. Next, I want to be able to UPDATE the forms values, where necessary. Is there an easy way to UPDATE the entire form from the reviewable version. Is it smarter to update ONLY the specific items that need modification? Any examples would be helpful.
-
Thanks for the help, but I think i got it! Now I have different questions, but at least I'm making progress! Thanks again.
-
My form has input1 and input2. It then adds them and displays as TOTAL. All 3 items have NAMES, and the form submission apparently grabs ALL the names to carry the info to the database. Is a field for each of the 3 items REQUIRED for the database to accept the data? I only need the two inputs for access.
-
I know that I can fairly easily pull my data from the database and view it in a browser. I can also 'polish' it with some HTML or put it into a table. Can I get an item from a given VARIABLE to appear inside of an INPUT box, so that it looks the same as when it was initially submitted? Can it be done with a multiple choice SELECT dropdown, so that the item chosen is viewable again?
-
TWO questions: I haven't actually CONNECTED and POSTED. My form has two input fields that combine in a TOTAL field. I notice that the address bar is carrying TOTAL=input1+input2 when it TRIES to connect. Do I need to include the TOTAL field in the database if the info is NOT relavant data? the strg and chick TOTALS? Will the database accept PARTIAL data from a form that has 25 field with only 6 being populated for testing?
-
STill, I haven't actually CONNECTED and POSTED. Do I need to include fields for the strg and chick TOTALS? will the database accept PARTIAL data from a form that has 25 field with only 6 being populated for testing?
-
My form begins with: <form name="orderpage" action="passpost.php" method="post"> <table> OOPS!!! never mind. Now I feel stupid. Been staring at this for 6 hours, and when I cut and pasted the code I noticed I had 2 form tags, so the submit was actually outside the process. Now I'm fine. This is why I'm just a PUP (or PUPIL) at this point. Sometimes you just need a second set of eyes to see it! Thanks for the assist.
-
The HTML looks something like this all the way throuogh: <tr><td> <select name="brisket"> <option value="0.00" selected> --- </option> <option value="1.00"> 1 </option> <option value="2.00"> 2 </option> <option value="3.00"> 3 </option> <option value="4.00"> 4 </option> <option value="5.00"> 5 </option> <option value="6.00"> 6 </option> <option value="7.00"> 7 </option> <option value="8.00"> 8 </option> <option value="9.00"> 9 </option> <option value="10.00">10 </option> </select></td><td>BRISKET OF BEEF</td><td>32.00 LB</td><td>ujiujjpooj</td><td> <!-- FILLER --> </td> <td> <select name="carrots"> <option value="0.00" selected> --- </option> <option value="1.00"> 1 </option> <option value="2.00"> 2 </option> <option value="3.00"> 3 </option> <option value="4.00"> 4 </option> <option value="5.00"> 5 </option> <option value="6.00"> 6 </option> <option value="7.00"> 7 </option> <option value="8.00"> 8 </option> <option value="9.00"> 9 </option> <option value="10.00">10 </option> </select></td><td>CARROTS</td><td> and my PHP is here: <?php require('connection.php'); mysql_connect("$hostname", "$username", "$password") or die ('Unable to connect to database!); mysql_select_db("$database") or die('Could not connect to db: ' . mysql_error()); if(isset($_POST['action']) && $_POST['action'] == 'submitform') { $roastturkey = $_POST['roastturkey']; $broccoli = $_POST['broccoli']; $brisket = $_POST['brisket']; $carrots = $_POST['carrots']; $EZchix_sum= $_POST['EZchix_sum']; $chixcutlet = $_POST['chixcutlet']; $chixfingers = $_POST['chixfingers']; $strgbalmond_sum=$_POST['strgbalmond_sum']; $strgbalmond1 = $_POST['strgbalmond1']; $strgbalmond2 = $_POST['strgbalmond2']; $strgbalmond3 = $_POST['strgbalmond3']; } $sql = "INSERT INTO dinnertable (roastturkey,broccoli,brisket,carrots,chixcutlet,chixfingers,strgbalmond1,strgbalmond2,strgbalmond3) VALUES ('','$roastturkey','$broccoli','$brisket','$carrots','$chixcutlet','$chixfingers','$strgbalmond1','$strgbalmond2','$strgbalmond3')"; $result=mysql_query($sql); // if successfully insert data into database, displays message "Successful". if($result){ echo "Successful"; else { echo "ERROR"; } > I just noticed that the feature for the TOTAL chicken and strgbalmond were being carried in the address bar. They are not important for my database, but maybe i needfields for them anyway???? Anditionally, I created a simple form with one field and a submit and ran it through my insert script and I got a successful connection and error message. Then I re-wrote my button on this form, and still no connection. Is the something about HTML 'selects' that I'm missing? Or a PHP comma or quote??
-
I have a form with a table that contains ONLY dropdown menus for users to select quantities from 25 dinner items. It contains some Javascript, but nothing fancy. In an effort to establish my database and TEST to see how some PHP functions might respond so I could improve my form, I created a mini version of the db in MySQL. But when I click the submit button, the page blinks, the address bar fills with field names, but there is no connect. No error messages. No data transfer. NO NOTHING! I searched the web and copied a form and plugged it in (an html form, a php insert file, and a MySQL database) and it worked fine. I peared down my page to mirror it, and still, no success. What little detail am I missing?? If I have 25 fields but create a db for the first 6, should it function? If I reduce it and try to re-use the same db, am I persuing a problem? I've tried error trapping and changing the form inputs, but it just still doesn't connect. Please help!