Jump to content


  • Posts

  • Joined

  • Last visited

Posts posted by phppup

  1. 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.



  2. 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>



    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.

  3. So I would have:


    $record_id = (isset($_POST['record_id'])) ? $_POST['record_id'] : '';

    //check for $record_id emptiness




    "SELECT * FROM mytable WHERE id = $record_id "



    Is that correct??  Am I missing any brackets or braces??


  4. 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.

  5. 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!


  6. 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.



  7. 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.

  8. 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.

  9. 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?

  10. 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?


  11. My form begins with:

    <form name="orderpage" action="passpost.php" method="post">



    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.


  12. The HTML looks something like this all the way throuogh:


          <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>


          <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>



    and my PHP is here:





    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'];


    $strgbalmond1 = $_POST['strgbalmond1'];

    $strgbalmond2 = $_POST['strgbalmond2'];

    $strgbalmond3 = $_POST['strgbalmond3'];



    $sql = "INSERT INTO dinnertable (roastturkey,broccoli,brisket,carrots,chixcutlet,chixfingers,strgbalmond1,strgbalmond2,strgbalmond3) VALUES




    // if successfully insert data into database, displays message "Successful".


    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??


  13. 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!

  14. As long as I'm logged in (although this may be more to the topic of 'table structure'), my table has fields for small, medium, and large blue candles and small, medium, and large pink candles.

    When an order is placed, the quantity requested is INSERTED into the correct field.


    Am I creating unnecessary overhead?


    Is there a way to have just one field for blue candles and one for pink, whereby the INSERT will record a customer request for 4 candles that are the small size?  And how would I retrieve the data when I want to know both the total number of candles and their sizes.


    Note: the order form has radio buttons for the sizes, so a single order can only accept a single size per submission.  Not sure if there's a simple way around that, but I'm learning more each day.


    Thanks in advance.

  15. Details:  Working for a company that sells candles in packages of 1,2,3,4,5 and 6. 

    Their website is set, and their database is adequate.


    Situation: I need to be able to breakdown large orders for efficient packaging.  So, if a customer orders twelve candles, I could transpose the order into 2 six-packs.  If the order were for sixteen candles, the order would transpose to 2 six-packs and 1 four-pack.  Always using the largest sized sets possible.

    Do NOT want an order for 12 being assembled as 3 fours or 4 threes, as it is inefficient.


    Can the quantity be INSERTED into the table accordingly, or does it need to be inserted as 16 (for example) and then broken down afterward??


    I am not sure whether I can do this in PHP or if a JavaScript is better.


    Obviously, i need to divide the largest orders by six, but not sure how to get that number, and how to incorporate the remainder.


    Please help.


    i used to have a stress ball.... ya know, those rubbery things for you to squeeze and throw to AVOID real damage, but I broke it! 




  16. Some attendees submitted duplicate (but identical) information into the form in order to obtain more than one ticket, so they occuppy several record lines.  However, I only need to send ONE email to that person.  How can I filter through the records to make sure that only one email is sent even though the same email address may have been entered several times, so that I eliminate duplication?


    In other words, to send ONE email to each UNIQUE address.

  17. Yes, very generic and I apologize.  It's probably due to my novice status.  I've searched websites and bookstores and it seems that authors write volumes on the cars performance ability, but never show you where to put the key or which way to start the ignition.


    I don't have a preference as to where I run the script (probably because I haven't had the initial experience foro comparison yet).


    I know that I'm not trying anything too complicated.  The alternative I considered was to create an HTML form (in a hidden file).  This would give me a SUBMIT button to act as my "on switch" to get the ball rolling.  Is this my simplest solution? 


    Can I place the file in my FTP with the website, use a particular extension, double click, and have my operation underway?


    Many thanks for your help.

  18. I have a database with three fields: name, email, and event.  People signed on through a form and provided this information each time they wanted a ticket to attend Thanksgiving, Christmas, and New Years parties.


    Now I want to contact them by email WITHOUT using a CC or BCC function because I do NOT want my messages filtered as spam.


    How can I send each person a single email?

  • 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.