Jump to content

phppup

Members
  • Posts

    895
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by phppup

  1. The statement you provided does nothing. But when I use echo "There are " . $row['roastturkey'] ." servings"; inside my table, it provides the correct values (even when the ID is changed)
  2. Took out the single quote: echo "<option value='0.00' " . ($array['roastturkey'] == 0.00 ? 'selected="selected"' : '') . ">0</option>"; echo "<option value='1.00' " . ($array['roastturkey'] == 1.00 ? 'selected="selected"' : '') . ">1</option>"; echo "<option value='2.00' " . ($array['roastturkey'] == 2.00 ? 'selected="selected"' : '') . ">2</option>"; echo "<option value='3.00' " . ($array['roastturkey'] == 3.00 ? 'selected="selected"' : '') . ">3</option>"; echo "<option value='4.00' " . ($array['roastturkey'] == 4.00 ? 'selected="selected"' : '') . ">4</option>"; echo "<option value='5.00' " . ($array['roastturkey'] == 5.00 ? 'selected="selected"' : '') . ">5</option>"; echo "<option value='6.00' " . ($array['roastturkey'] == 6.00 ? 'selected="selected"' : '') . ">6</option>"; echo "<option value='7.00' " . ($array['roastturkey'] == 7.00 ? 'selected="selected"' : '') . ">7</option>"; echo "<option value='8.00' " . ($array['roastturkey'] == 8.00 ? 'selected="selected"' : '') . ">8</option>"; echo "<option value='9.00' " . ($array['roastturkey'] == 9.00 ? 'selected="selected"' : '') . ">9</option>"; echo "<option value='10.00' " . ($array['roastturkey'] == 10.00 ? 'selected="selected"' : '') . ">10</option>"; result in dropdown still at zero :-( What else would you test. AT this point, I'll give you the whole damn thing.. LOL
  3. I see what you mean. Made the change, but still no difference. The DB field is VARCHAR and displays x.xx for value. When I changed back to ZERO as the comparison, my result shifts to 10. Don't know why.
  4. I've changed it from: echo "<option value='0.00' " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">0</option>"; echo "<option value='1.00' " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">1</option>"; echo "<option value='2.00' " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">2</option>"; echo "<option value='3.00' " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">3</option>"; echo "<option value='4.00' " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">4</option>"; echo "<option value='5.00' " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">5</option>"; echo "<option value='6.00' " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">6</option>"; echo "<option value='7.00' " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">7</option>"; echo "<option value='8.00' " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">8</option>"; echo "<option value='9.00' " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">9</option>"; echo "<option value='10.00' " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">10</option>"; to echo "<option value='0.00' " . ($array['roastturkey'] == '0' ? 'selected="selected"' : '') . ">0</option>"; echo "<option value='1.00' " . ($array['roastturkey'] == '1' ? 'selected="selected"' : '') . ">1</option>"; echo "<option value='2.00' " . ($array['roastturkey'] == '2' ? 'selected="selected"' : '') . ">2</option>"; echo "<option value='3.00' " . ($array['roastturkey'] == '3' ? 'selected="selected"' : '') . ">3</option>"; echo "<option value='4.00' " . ($array['roastturkey'] == '4' ? 'selected="selected"' : '') . ">4</option>"; echo "<option value='5.00' " . ($array['roastturkey'] == '5' ? 'selected="selected"' : '') . ">5</option>"; echo "<option value='6.00' " . ($array['roastturkey'] == '6' ? 'selected="selected"' : '') . ">6</option>"; echo "<option value='7.00' " . ($array['roastturkey'] == '7' ? 'selected="selected"' : '') . ">7</option>"; echo "<option value='8.00' " . ($array['roastturkey'] == '8' ? 'selected="selected"' : '') . ">8</option>"; echo "<option value='9.00' " . ($array['roastturkey'] == '9' ? 'selected="selected"' : '') . ">9</option>"; echo "<option value='10.00' " . ($array['roastturkey'] == '10' ? 'selected="selected"' : '') . ">10</option>"; and now I get ZERO for all the ID's that I query. The INITIAL default value is ZERO. Then the value changes when the data is submitted though the form initially and posted into the DB. Does the value that is input need to be coompared. Does the hardcoding need to be altered for every instance AFFTER the data is recorded?
  5. The items in the form are each genreated by a line like this: echo "".$row['ITEM1'].""; There many items. Some are zero, some are greater. Is there a tool (like *) that I can use with a > function for the entire form, or do i need to apply the form for every item individually?
  6. FULL STORY REPEATED: A form inputs data into several fields named turkey, roastbeef, spinach, potatoes, etc (i'll stop bc it's lunchtime now... LOL). Input process is FINE. Now DB has several entries with varying quantiities in each. Record A has 5 (orders) of turkey and 2 spinach Record B has 3 (orders) of roast beef and 1 spinach, and 2 potaoes, etc. Any item NOT ordered has a DEFAULT of ZERO. I can successfully view all orders in a browser... NO PROBLEM. Now I have a SECOND form (identical to the first) and I want to ECHO the values into it. I want those values to appear INSIDE the dropdown with the info from the database so that the option that is saved in the database will be new default when the form page is loaded, and will SHOW in the form so that if customer A decides that 5 orders of turkey is too much, then the order can be UPDATED to the DB with the NEW VALUE. If I don't change it to the previous info it will update the database with the default option rather then the actual option when re-submitted. My SECOND form has a dropdwon menu coded as follows" echo "<tr><td>"; echo "<select name='roastturkey'>"; echo "<option value='0.00' " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">0</option>"; echo "<option value='1.00' " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">1</option>"; echo "<option value='2.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">2</option>"; echo "<option value='3.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">3</option>"; echo "<option value='4.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">4</option>"; echo "<option value='5.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">5</option>"; echo "<option value='6.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">6</option>"; echo "<option value='7.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">7</option>"; echo "<option value='8.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">8</option>"; echo "<option value='9.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">9</option>"; echo "<option value='10.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">10</option>"; echo " </select></td><td rowspan='2'>ROAST TURKEY</span></td><td rowspan='2'>7.00 LB</span></td> "; and I am currently using the statement: $result = mysql_query("SELECT * FROM mytablename WHERE id = '5' ") just to get a value for testing purposes. Then I change the ID within the statement to check the functionality. At first, there was NO SUCCESS. Yesterday, I got the dropdown's value to change to 10 (which was valid). But NOW the dropdown has 'adopted' 10 as the default, as it does NOT CHANGE when I alter the ID value to orders that contain a value that is NOT 10 in them. Any solutions?
  7. You need to READ the 3 pages prior. NOTHING is being COUNTED. There is data in a DB. I can easily view it in a browser. Now I want to have the same data populated into the numerous dropdown selections so the information resembles that which was ORIGINALLY submitted AND become the NEW DEFAULT VALUES so that THIS form can be submitted to UPDATE or CHANGE any of the data. That's the entire project.
  8. Is PHP the best way to open the new window. Zeta said she hoped this helps someone else, so here i am thinking it through. I have a PHP for putting data into a DB. The idea is that someone else will be able to access the column totals periodically. My structure is to have another form with options. Each option will run into a SELECT function that will provide information. Normally, this would be displayed on the browser, but I've found (not yet implemented) that Javascript can open a NewWindow and should be able to make the display there WITHOUT involving PHP. Am I doing something that makes sense, or sounds stupid? Feasible or futile?
  9. Correct! Although the dropdown is hardcoded as: echo "<option value='0.00' " . ($array['roastturkey'] == '0.00' ? 'selected="selected"' : '') . ">0</option>";echo "<option value='1.00' " . ($array['roastturkey'] == '1.00' ? 'selected="selected"' : '') . ">1</option>";echo "<option value='2.00'> " . ($array['roastturkey'] == '2.00' ? 'selected="selected"' : '') . ">2</option>";echo "<option value='3.00'> " . ($array['roastturkey'] == '3.00' ? 'selected="selected"' : '') . ">3</option>";echo "<option value='4.00'> " . ($array['roastturkey'] == '4.00' ? 'selected="selected"' : '') . ">4</option>";echo "<option value='5.00'> " . ($array['roastturkey'] == '5.00' ? 'selected="selected"' : '') . ">5</option>";echo "<option value='6.00'> " . ($array['roastturkey'] == '6.00' ? 'selected="selected"' : '') . ">6</option>";echo "<option value='7.00'> " . ($array['roastturkey'] == '7.00' ? 'selected="selected"' : '') . ">7</option>";echo "<option value='8.00'> " . ($array['roastturkey'] == '8.00' ? 'selected="selected"' : '') . ">8</option>";echo "<option value='9.00'> " . ($array['roastturkey'] == '9.00' ? 'selected="selected"' : '') . ">9</option>";echo "<option value='10.00'> " . ($array['roastturkey'] == '10.00' ? 'selected="selected"' : '') . ">10</option>"; So when I test the script it appears to work and shows 10 as the quntity for roastturkey. Yet when I change the quiery to a differnt ID=x, the quantity of 10 remains (as if frozen). The DB has a variety of qunatities in it with varying IDs just for testing. So the script FAILS because the quantity never changes from 10. Ideas???
  10. I'm trying to retrieve data from my DB and have it populate the dropdown values inside a form: echo "<option value='0.00' " . ($array['roastturkey'] == '0.00' ? 'selected="selected"' : '') . ">0</option>";echo "<option value='1.00' " . ($array['roastturkey'] == '1.00' ? 'selected="selected"' : '') . ">1</option>";echo "<option value='2.00'> " . ($array['roastturkey'] == '2.00' ? 'selected="selected"' : '') . ">2</option>";echo "<option value='3.00'> " . ($array['roastturkey'] == '3.00' ? 'selected="selected"' : '') . ">3</option>";echo "<option value='4.00'> " . ($array['roastturkey'] == '4.00' ? 'selected="selected"' : '') . ">4</option>";echo "<option value='5.00'> " . ($array['roastturkey'] == '5.00' ? 'selected="selected"' : '') . ">5</option>";echo "<option value='6.00'> " . ($array['roastturkey'] == '6.00' ? 'selected="selected"' : '') . ">6</option>";echo "<option value='7.00'> " . ($array['roastturkey'] == '7.00' ? 'selected="selected"' : '') . ">7</option>";echo "<option value='8.00'> " . ($array['roastturkey'] == '8.00' ? 'selected="selected"' : '') . ">8</option>";echo "<option value='9.00'> " . ($array['roastturkey'] == '9.00' ? 'selected="selected"' : '') . ">9</option>";echo "<option value='10.00'> " . ($array['roastturkey'] == '10.00' ? 'selected="selected I'm using this code, but cannot get the data that's inside the DB to populate the dropdown value. 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.
  11. If I use this code: $values = range(0, 10); echo "<select name=\"my_field\">\n"; foreach($values as $v) { echo "<option value=\"$v\">$v</option>\n"; }echo "</select>\n"; to generate a dropdown, it will offer options from 1 thru 10. Is there any way to make them increment by .50 (ie: 0.0, 0.5, 1.0, 1.5, 2.0, 2.5, etc.?
  12. I haven't changed the comparison value because I don't know where or how or to what... silly me :-) As a matter of fact, what I probably did throughout the process was to change it inaccuratley. So, what's my next step please?
  13. Let's try something simple: I have a form that retrieves data from database and organizes the numbers inside of a table (sometimes in an input box). Is there a simple code so that VALUES > zero will be in BOLD font?
  14. OKAY, so I managed to get a 5 in as the dropdown default for record number 4. Now I changed my quiery to record number 5, but the dropdown seems STUCK on 10. The value for record 4 for 'roastturkey' is FIVE. Any ideas???
  15. I've been refreshing ALL day. I have a dropdwon menu coded as follows" echo "<tr><td>"; echo "<select name='roastturkey'>"; echo "<option value='0.00' " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">0</option>"; echo "<option value='1.00' " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">1</option>"; echo "<option value='2.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">2</option>"; echo "<option value='3.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">3</option>"; echo "<option value='4.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">4</option>"; echo "<option value='5.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">5</option>"; echo "<option value='6.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">6</option>"; echo "<option value='7.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">7</option>"; echo "<option value='8.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">8</option>"; echo "<option value='9.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">9</option>"; echo "<option value='10.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">10</option>"; echo " </select></td><td rowspan='2'>ROAST TURKEY</span></td><td rowspan='2'>7.00 LB</span></td> "; And a database quierie after connecting is: $result = mysql_query("SELECT * FROM pass WHERE id = '4' ") 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 form 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 when re-submitted. Record 4 has 10 as the value for the 'roastturkey'. I've changed it to record 5 which has a value of 5, but the dropdown does NOT change.
  16. OKAY, the dropdown is now populated with number from 0 thru 10. The database quierie after connecting is: $result = mysql_query("SELECT * FROM pass WHERE id = '4' ") Record 4 has 10 as the value for the 'roastturkey'. I've changed it to record 5 which has a value of 5, Yet the dropdown STILL does NOT change to reflect the stored value in the database :-(
  17. That was the first thinig I did. I mean, I'm not totally ignorant. I switched a few numbers and this is what I have now: echo "<tr><td>"; echo "<select name='roastturkey'>"; echo "<option value='0.00' " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">0</option>"; echo "<option value='1.00' " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">1</option>"; echo "<option value='2.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">2</option>"; echo "<option value='3.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">3</option>"; echo "<option value='4.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">4</option>"; echo "<option value='5.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">5</option>"; echo "<option value='6.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">6</option>"; echo "<option value='7.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">7</option>"; echo "<option value='8.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">8</option>"; echo "<option value='9.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">9</option>"; echo "<option value='10.00'> " . ($array['roastturkey'] == 0 ? 'selected="selected"' : '') . ">10</option>"; echo " </select></td><td rowspan='2'>ROAST TURKEY</span></td><td rowspan='2'>7.00 LB</span></td> "; The drop down shows as follows: 0 1 selected="selected">2 selected="selected">3 selected="selected">4... etc. And the database quierie after connecting is: $result = mysql_query("SELECT * FROM pass WHERE id = '4' ") Record 4 has 10 as the value for the 'roastturkey'. I've changed it to record 5 which has a value of 5, but the dropdown does NOT change.
  18. Nope! It's populating the dropdown with 10 lines of: selected="selected">0 Not the value that the table has.
  19. oops! maybe not. But I think I may be able to fix it... keep you posted.
  20. EUREEEEEEKAH!!!! IT WORKED!!!! *hugs & kisses* JUMPS for JOY!!!!!
  21. I'm plugging it in now.
  22. So am I abandoning Pikachu?? I modified: echo " <option value='1.00'>1 <?php echo $array['roastturkey'] == 0 ? 'selected="selected"' : ''>0</option>"; To this echo "<option value='1.00' $array['roastturkey'] == 0 ? 'selected="selected"' : ''>0</option>"; BUT NOT WORKING!
  23. Pasted it in with my code from Reply #4. I have a feeling I'm duplicating ECHOs because I received error message for first line of modified code. Also, I need to ensure that unselected items maintain their default. Is there a way to incorporate that?
  24. Now I'm BEGINNING to see it! And UNDERSTAND what you mean. Is the code that Scootstah offered earlier applicable as a simpler means? Meanwhile, let me hardcode ONE selection just to see that it works.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.