The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Page 1 of 2 12 LastLast
Results 1 to 15 of 20

Thread: PHP Form

  1. #1

    PHP Form

    Hello out there:
    I am new to PHP and MySQL, so any and all help that anyone can offer me would be greatly appreciated. Here is my situation.

    I have a database that I created that is used for storing names and descriptions of different products that I plan on selling. When I go to different events to sell these products, I wanted to create a form that I can fill out that will let me know how many of each product that I've brought, how many I've sold, and the standard price that each item was sold for at that particular event. It sounded basic to me when I started the idea, but here is the problem that I am running into and my lack of knowledge of this stuff is keeping me cornered and stuck. I have a button on my site that I click onto and by doing so, it is supposed to check the database that I created, find out how many products are in the Products table at that time, and then display that number of <input type="text"> boxes (one for each product in the database). So basically, if there are 10 products, I need the first part of the coding to display each product name, a text box for each product so I can enter the number of products brought to sell, a text box for each product so I can enter the number of each product that was sold, and a text box for each product so I can enter the standard price that the products were sold for at that particular event.

    As far as the above situation, I was able to find a way to do that but here is my snag. In order to accomplish the above situation, I just ran a SELECT statement to select everything in the Products table and ran the mysql_fetch_array to have each prodcut be printed out with the different text boxes. But the problem I'm running into, is that once I input the information into the text boxes, how do I get PHP to read that information and INPUT it into a different table that I've created. The problem I'm having is that in order for PHP to recognize the value that is entered into each text box, each text box has to have an individual name. But I can't seem to find a way to give each text box a different name and write the coding to get it to input. I'm stuck.

    If anyone out there has any ideas on how to do this, or even if I'm approaching this idea in the wrong manner, please let me know. I would appreciate any help, like I said, I'm very new and am afraid that I was trying to bite off more than I could chew on my own.....so that's why I'm seeking help from the experts.

    Thanks,
    Dan

  2. #2
    this is a common problem that a lot of programmers should face, I think you're going in the right direction.
    I presume you have a id key value in your products table.
    So what to do:
    make the name of the edit id_name
    so when posting it to php you just do the same and ask for get or post values
    by

    not real code: ( description )

    for ( all products )
    {
    $name = $product_row->id . '_' . 'name'
    $post_value = $_POST ( or get ) ['$name'];
    update_productrow set somefield = $post_value where id= product_row->id;
    }
    Last edited by borrob; January 24th, 2008 at 07:23 AM.

  3. #3
    First off, thank you for reponding quickly to my post. I greatly appreciate it.
    As fast as the id key in my products table, I do have a field that is set as my primary key. Is that what you are referring to? (like I said, when it comes to this stuff, especially the termanology, I get so confused sometimes) :-) The field that the primary key is set up for is called product_id.
    As far as the coding you offered me down below, I think I understand some of it, but some of it I'm a bit lost on. It's not because of you, it's because of my PHP inexperience. So what I thought might be helpful, is if I include some of the code that I've already come up with, and then you can show me where I'm wrong and where I should fit in the coding that you are suggesting. That would be very helpful. So below, is the code that I've come up with so far:

    <?php
    session_start();

    include 'database.php';
    $sql = "SELECT * FROM Products";
    $sql_result = mysql_query($sql,$connection) or die ('Could not select');

    $sql_products = mysql_query("SELECT * FROM Products");
    $numrows = mysql_num_rows($sql_products);

    ?>
    <form name="concertentry" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <?php
    session_start();

    include 'database.php';

    while($row = mysql_fetch_array($sql_result)){
    print "<tr><td align=\"center\"><font face=\"Arial\" size=\"1\">" .$row[1]. "</font></td><td align=\"center\"><input type=\"text\" name=\"nobrought" .$row[0]. "\" size=\"4\"></td><td align=\"center\"><input type=\"text\" name=\"nosold" .$row[0]. "\" size=\"4\"></td><td align=\"center\"><font face=\"Arial\" size=\"1\"><b>$</b></font><input type=\"text\" name=\"saleprice".$row[0]."\" size=\"4\"></td><td align=\"center\"><font face=\"Arial\" size=\"1\">$" .$row[2]. "</font><input type=\"submit\" value=\"enter\" name=\"enter".$row[0]."\"></td></tr>";
    }

    print "<input type=\"submit\" name=\"submit\" value=\"submit\">";

    As you can probably see from the above coding, in the WHILE statement where I run the mysql_fetch_array, it prints out 3 different text boxes for each product (which in the case right now, I have a total of 10 products in the Products Table. So the above code should print out 10 different rows with 3 text boxes per row. If you notice though, I couldn't figure out how to name each text box. I used the code above, which does in fact give unique names to each box, but I can't seem to figure out how to get those names to $_POST variables so that I can get them to INSERT into the table I have set up for them on the database.

    If you could fill me in on where I'm wrong and where you're going should go, that would be awesome.

    Thank you for the assistance so far. You're help is much appreciated because I have been banging my head on my desk for weeks trying to figure this out. I even went out and bought a book hoping it would help and yet I'm no farther along then before.

    Thanks:
    Dan

  4. #4
    i have shortened it to one field burt you should get the general idea....


    Code:
    <?php
    session_start();
    include 'database.php';
    
    $sql = "SELECT * FROM Products"; 
    
    $act = 'open';
    if( isSet( $_POST['act'] ) ) 
    {
        $act = $_POST['act'];    
    }
    
    if( $act == 'update'  )
    {
        $sql_result = mysql_query($sql,$connection) or die ('Could not select');
        while( $row = mysql_fetch_array( $sql_result ) )
        {
            $post_name = "nobrought_" . $row[0];
            if( isSet( $_POST[ $post_name ] ) )
            {
                $sql = 'update products set nobrought = ' . $_POST[$post_name] . " where product_id= " . $row[0];
                // now take care that you don't overwrite the existing result
                // you'll have to update this in a new connection otherwise the $resultset will be overwritten
                // excute the update sql and you'r there.....
            }   
            
        }
        
    }
    
    
    $sql_result = mysql_query($sql,$connection) or die ('Could not select');
    
     echo "<form name='concertentry' method='post' action='" . $_SERVER['PHP_SELF'] . ">";
    
    
    while( $row = mysql_fetch_array( $sql_result ) )
    {
        print "<tr>";
        print "<td align=\"center\"><input type=\"text\" name=\"nobrought_" .$row[0]. "\" value=\"" . $row[1] . "\" size=\"4\"></td>";
        print "</tr>";
    
    
    }
    print "<input type=\"hidden\" name=\"act\" value=\"update\">";
    print "<input type=\"submit\" name=\"submit\" value=\"submit\">";
    
    echo "</form>";
    ?>

  5. #5
    biznuge's Avatar
    1,136
    posts
    Use the Fork Luke...
    think you might be sort of confusing yourself here...

    PHP Code:
    <?php
    session_start
    ();
    include 
    'database.php';

    $sql "SELECT * FROM Products"

    $act 'open';
    if( isSet( 
    $_POST['act'] ) ) 
    {
        
    $act $_POST['act'];    
    }

    if( 
    $act == 'update'  )
    {
        
    $sql_result mysql_query($sql,$connection) or die ('Could not select');
        while( 
    $row mysql_fetch_array$sql_result ) )
        {
            
    $post_name "nobrought_" $row[0];
            if( isset( 
    $_POST$post_name ] ) ) // NOTE 1 - isSet should be isset...
            
    {
                
    $sql 'update products set nobrought = ' $_POST[$post_name] . " where product_id= " $row[0];
                
    // now take care that you don't overwrite the existing result
                // you'll have to update this in a new connection otherwise the $resultset will be overwritten
                // excute the update sql and you'r there.....
            
    }   
            
        }
        
    }


    $sql_result mysql_query($sql,$connection) or die ('Could not select');

     echo 
    "<form name='concertentry' method='post' action='" $_SERVER['PHP_SELF'] . ">";


    while( 
    $row mysql_fetch_array$sql_result ) ) //NOTE 2 you won't get a result_set back from this query as it's the result of an "UPDATE" not a "SELECT"
    {
        print 
    "<tr>";
        print 
    "<td align=\"center\"><input type=\"text\" name=\"nobrought_" .$row[0]. "\" value=\"" $row[1] . "\" size=\"4\"></td>";
        print 
    "</tr>";


    }
    print 
    "<input type=\"hidden\" name=\"act\" value=\"update\">";
    print 
    "<input type=\"submit\" name=\"submit\" value=\"submit\">";

    echo 
    "</form>";
    ?>

    at "NOTE 2" i think you might be able to simply use 'mysql_insert_id' which i think should give you back the last id operated on with your mysql session, you could then use this primary key id / row value as the basis for a third query, which would be a select based on the result of the "mysql_insert_id"

    Hope this is someway in the right direction.
    before you judge someone, you should walk a mile in their shoes. That way, when you judge them, you're a mile away, and you have their shoes...
    "A lack of planning on your part does not constitute an emergency on mine" - Danonthemoon
    She asked for a double entendre, so I gave her one...
    "screw ie. it can lick my balls" - A.J. Cates

  6. #6
    Thank you so much for getting back to me again. I think I'm actually starting to understand the coding. So what I did, was took your coding, and put it into my script. The only problem that I'm having right now, is that I think there is a syntax error somewhere, but I can't seem to find it. The reason I think that is because when I try to access that PHP script, all I get is a blank white page.....nothing displays.

    If you don't wmind (and again, thank you for the help thus far), could you take a look at the coding that I have now and let me know where my syntax problem is (if a syntax problem is what it truly is).

    It might be bogged down with a whole bunch of boring stuff that doesn't affect the script, but I just thought it would be easier if you could see all the script...every last semi-colon. :-)


    Code:
    <?php
    session_start();
    include 'database.php';
    print "<TABLE ALIGN=\"center\" WIDTH=\"490\" style=\"border: 1 solid #000000; padding-top: 0\">";
    print "<TR><TD COLSPAN=\"5\" bgcolor=\"#C0C0C0\" width=\"482\">";
    print "<font face=\"Arial\" size=\"2\">Concert Entry Form</font>";
    print "</td></tr>";
    print "<TR><TD COLSPAN=\"5\" width=\"482\">&nbsp;";
    print "</td></tr>";
    print "<TR><TD width=\"238\">";
    print "&nbsp;<font face=\"Arial\" size=\"1\">Event Title:</font>&nbsp;&nbsp;<INPUT TYPE=\"text\" NAME=\"eventtitle\" size=\"18\">";
    print "</td>";
    print "<TD COLSPAN=\"5\" width=\"238\">";
    print "&nbsp;<font face=\"Arial\" size=\"1\">Event Location:</font>&nbsp;&nbsp;<INPUT TYPE=\"text\" NAME=\"eventlocation\" size=\"18\">";
    print "</td></tr>";
    print "<TR><TD COLSPAN=\"5\" width=\"482\">";
    print "&nbsp;<font face=\"Arial\" size=\"1\">Event Date:</font>&nbsp;&nbsp;";
    print "<SELECT NAME=\"eventday\"><OPTION VALUE=\"date\">date</option><OPTION VALUE=\"Sunday\">Sunday</option><OPTION VALUE=\"Monday\">Monday</option><OPTION VALUE=\"Tuesday\">Tuesday</option><OPTION VALUE=\"Wednesday\">Wednesday</option><OPTION VALUE=\"Thursday\">Thursday</option><OPTION VALUE=\"Friday\">Friday</option><OPTION VALUE=\"Saturday\">Saturday</option></select>&nbsp;&nbsp; &nbsp;";
    print "<SELECT NAME=\"eventmonth\"><OPTION VALUE=\"month\">month</option><OPTION VALUE=\"01\">01-January</option><OPTION VALUE=\"02\">02-February</option><OPTION VALUE=\"03\">03-March</option><OPTION VALUE=\"04\">04-April</option><OPTION VALUE=\"05\">05-May</option><OPTION VALUE=\"06\">06-June</option><OPTION VALUE=\"07\">07-July</option><OPTION VALUE=\"08\">08-August</option><OPTION VALUE=\"09\">09-September</option><OPTION VALUE=\"10\">10-October</option><OPTION VALUE=\"11\">11-November</option><OPTION VALUE=\"12\">12-December</option></select>&nbsp; &nbsp;&nbsp;";
    print "<SELECT NAME=\"eventdate\"><OPTION VALUE=\"day\">day</option><OPTION VALUE=\"01\">1st</option><OPTION VALUE=\"02\">2nd</option><OPTION VALUE=\"03\">3rd</option><OPTION VALUE=\"04\">4th</option><OPTION VALUE=\"05\">5th</option><OPTION VALUE=\"06\">6th</option><OPTION VALUE=\"07\">7th</option><OPTION VALUE=\"08\">8th</option><OPTION VALUE=\"09\">9th</option><OPTION VALUE=\"10\">10th</option><OPTION VALUE=\"11\">11th</option><OPTION VALUE=\"12\">12th</option><OPTION VALUE=\"13\">13th</option><OPTION VALUE=\"14\">14th</option><OPTION VALUE=\"15\">15th</option><OPTION VALUE=\"16\">16th</option><OPTION VALUE=\"17\">17th</option><OPTION VALUE=\"18\">18th</option><OPTION VALUE=\"19\">19th</option><OPTION VALUE=\"20\">20th</option><OPTION VALUE=\"21\">21th</option><OPTION VALUE=\"22\">22nd</option><OPTION VALUE=\"23\">23rd</option><OPTION VALUE=\"24\">24th</option><OPTION VALUE=\"25\">25th</option><OPTION VALUE=\"26\">26th</option><OPTION VALUE=\"27\">27th</option><OPTION VALUE=\"28\">28th</option>";
    print "<OPTION VALUE\"29\">29th</option><OPTION VALUE=\"30\">30th</option><OPTION VALUE=\"31\">31st</option></select>&nbsp;&nbsp; &nbsp;";
    print "<SELECT NAME=\"eventyear\"><OPTION VALUE=\"year\">year</option><OPTION VALUE=\"2007\">2007</option><OPTION VALUE=\"2008\">2008</option><OPTION VALUE=\"2009\">2009</option><OPTION VALUE=\"2010\">2010</option><OPTION VALUE=\"2011\">2011</option><OPTION VALUE=\"2012\">2012</option></select>";
    print "<br><br><hr><br>";
    print "</td></tr>";
    print "<tr><td colspan=\"5\">&nbsp;</td></tr>";
    print "<tr><td align=\"center\" bgcolor=\"#C0C0C0\">";
    print "<font face=\"Arial\" size=\"1\">PRODUCT</font>";
    print "</td><td align=\"center\" bgcolor=\"#C0C0C0\">";
    print "<font face=\"Arial\" size=\"1\">NO. BROUGHT</font>";
    print "</td><td align=\"center\" bgcolor=\"#C0C0C0\">";
    print "<font face=\"Arial\" size=\"1\">NO. SOLD</font>";
    print "</td><td align=\"center\" bgcolor=\"#C0C0C0\">";
    print "<font face=\"Arial\" size=\"1\">SALE PRICE</font>";
    print "</td><td align=\"center\" bgcolor=\"#C0C0C0\">";
    print "<font face=\"Arial\" size=\"1\">ORIGINAL UNIT PRICE</font>";
    print "</td></tr>";
     
    $sql = "SELECT * FROM Products";
    $act = 'open';
    if (isset($_POST['act'])) {
        $act = $_POST['act'];
    }
    if ($act == 'update') {
        $sql_result = mysql_query($sql,$connection) or die ('Could not select the info');
        while( $row = mysql_fetch_array($sql_result)) {
     $post_name = "nobrought_" . $row[0];
     if (isset($_POST[$post_name])) {
         $sql = "INSERT INTO Sales (No_Brought) VALUES ('$_POST[$post_name]');
     }
        }
    }
    $sql_result = mysql_query($sql,$connection) or die ('Could not select');
    echo "<form name=\"concertentry\" method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">";
    while( $row = mysql_fetch_array($sql_result)) {
        print "<tr>";
        print "<td align=\"center\"><input type=\"text\" name=\"nobrought_" .$row[0]. "\" value=\"" . $row[1] . "\" size=\"4\"></td>";
        print "</tr>";
    }
    print "<input type=\"hidden\" name=\"act\" value=\"update\">";
    print "<input type=\"submit\" name=\"submit\" value=\"submit\">";
    echo "</form>";
    ?>
    Quote Originally Posted by borrob View Post
    i have shortened it to one field burt you should get the general idea....


    Code:
    <?php
    session_start();
    include 'database.php';
     
    $sql = "SELECT * FROM Products"; 
     
    $act = 'open';
    if( isSet( $_POST['act'] ) ) 
    {
        $act = $_POST['act'];    
    }
     
    if( $act == 'update'  )
    {
        $sql_result = mysql_query($sql,$connection) or die ('Could not select');
        while( $row = mysql_fetch_array( $sql_result ) )
        {
            $post_name = "nobrought_" . $row[0];
            if( isSet( $_POST[ $post_name ] ) )
            {
                $sql = 'update products set nobrought = ' . $_POST[$post_name] . " where product_id= " . $row[0];
                // now take care that you don't overwrite the existing result
                // you'll have to update this in a new connection otherwise the $resultset will be overwritten
                // excute the update sql and you'r there.....
            }   
     
        }
     
    }
     
     
    $sql_result = mysql_query($sql,$connection) or die ('Could not select');
     
     echo "<form name='concertentry' method='post' action='" . $_SERVER['PHP_SELF'] . ">";
     
     
    while( $row = mysql_fetch_array( $sql_result ) )
    {
        print "<tr>";
        print "<td align=\"center\"><input type=\"text\" name=\"nobrought_" .$row[0]. "\" value=\"" . $row[1] . "\" size=\"4\"></td>";
        print "</tr>";
     
     
    }
    print "<input type=\"hidden\" name=\"act\" value=\"update\">";
    print "<input type=\"submit\" name=\"submit\" value=\"submit\">";
     
    echo "</form>";
    ?>

  7. #7
    biznuge's Avatar
    1,136
    posts
    Use the Fork Luke...
    if( isSet( $_POST[ $post_name ] ) )
    isSet should be isset

    are you using notepad or some plain text editor for this? why not get a copy of dreamweaver and then you'll be able to see sytactical errors as you code.
    before you judge someone, you should walk a mile in their shoes. That way, when you judge them, you're a mile away, and you have their shoes...
    "A lack of planning on your part does not constitute an emergency on mine" - Danonthemoon
    She asked for a double entendre, so I gave her one...
    "screw ie. it can lick my balls" - A.J. Cates

  8. #8
    Yeah, unfortunately I am using Notepad to write my PHP scripts. Believe it or not, I do have a copy of Dreamweaver, but I have never sat down to teach myself how to use it. But now that you told me the advantage it could have for me, I might have to start working with it. Thank you.

    Also, I took care of the syntax problem and now I'm getting the script to do some stuff. But unfortunately, I don't know if I'm where I need to be just yet. Close.....just not there completely, and here's why:

    The script goes out and finds out how many products exist and then displays that number of text boxes....that part rocks! And as of right now, there are 14 products in the table on the database, so the script displays 14 boxes (1 for each product). But here's the glitch that I found. To test it out, I entered a single number in each of the 14 text boxes and clicked on the Submit button. The problem is that the script should have created 14 different records into the table (1 for each of the 14 numbers that I typed into the boxes). However, it only grabbed the number from the very last box (the 14th box), and inputed that into the table. So is there a way I can modify the code to get it to input all the records and not just one? (does this make sense...it is kind of difficult to explain by typing?) I am so close though. In one day you have gotten me farther than I have been in weeks.....so we're almost there. Thanks again.

    Dan


    Quote Originally Posted by biznuge View Post
    isSet should be isset

    are you using notepad or some plain text editor for this? why not get a copy of dreamweaver and then you'll be able to see sytactical errors as you code.

  9. #9
    biznuge's Avatar
    1,136
    posts
    Use the Fork Luke...
    post your rendered form page, the one that will post off the info to the db, with the 14 boxes on.

    Might help to let the dog see the rabbit.
    before you judge someone, you should walk a mile in their shoes. That way, when you judge them, you're a mile away, and you have their shoes...
    "A lack of planning on your part does not constitute an emergency on mine" - Danonthemoon
    She asked for a double entendre, so I gave her one...
    "screw ie. it can lick my balls" - A.J. Cates

  10. #10
    Here is a link to the rendered form. It should give you an idea of what it will basically look like (ignore the location of the text boxes, they will actually be underneath the "NO. BROUGHT" column).

    http://www.truewitnessalbums.com/Con...FormTrials.php

    As you can see, there are 14 boxes displayed, that is because there are 14 different products (if there were 10 products, then there would only be 10 boxes, etc). I need to find away that when I click on the Submit button (which will eventually be moved below the textg boxes), that it will take the values of whatever information I enter in those boxes, and insert all of those values into a table called Sales on the database.

    If you need more info, please let me know. Thanks for the help yet again.

    -- Dan

  11. #11
    biznuge's Avatar
    1,136
    posts
    Use the Fork Luke...
    think a good point to raise would be echoing your $_post, and query strings out to the screen, to make absolutely sure what you are posting to the DB is actually what you are assuming you're posting. Have a go at rendering each and every query out, and then asee what you come up with mate.

    sorry, little busy this week, but I'll keep checking this thread if possible.

    good luck.
    before you judge someone, you should walk a mile in their shoes. That way, when you judge them, you're a mile away, and you have their shoes...
    "A lack of planning on your part does not constitute an emergency on mine" - Danonthemoon
    She asked for a double entendre, so I gave her one...
    "screw ie. it can lick my balls" - A.J. Cates

  12. #12
    Thanks for getting back to me. I understand how busy things can get, so whenever you have a free chance to look at this, that would be great.

    I did what you suggested and here is the code:

    Code:
    if ($act == 'update') {
        $sql_result = mysql_query($sql,$connection) or die ('Could not select');
        while( $row = mysql_fetch_array($sql_result)) {
     $post_name = "nobrought_" . $row[0];
      if (isset($_POST[$post_name])) {
       $sql = "INSERT INTO Sales (No_Brought) VALUES ('$_POST[$post_name]')";
       print "The number are: " .$_POST[$post_name]. ". ";
      }
     }
    }
    I put a "print" after the INSERT statement to see what was indeed supposed to be inserting, and it printed each of the 14 numbers that I put into the text boxes. But when I went and checked the database, it is only INSERTING the number from the last (14th) text box. Why would it print all 14 but only insert the last of the 14? Is this a common problem with PHP and MySQL db?

    Thanks:

    Dan

  13. #13
    biznuge's Avatar
    1,136
    posts
    Use the Fork Luke...
    so, if i'm reading this right, you're doing 14 different, seperate INSERT statements? right?


    PHP Code:
    if ($act == 'update') {
        
    $sql_result mysql_query($sql,$connection) or die ('Could not select');
        while( 
    $row mysql_fetch_array($sql_result)) {
           
    $post_name "nobrought_" $row[0];
           if (isset(
    $_POST[$post_name])) {
              
    $sql "INSERT INTO Sales (No_Brought) VALUES ('$_POST[$post_name]')";
              print 
    "The number are: " .$_POST[$post_name]. ". ";
           }
        }

    Think the problem here, "may" stem from the fact that htere is no increment on which $row you are using...

    PHP Code:
    $post_name "nobrought_" $row[0]; 
    if (isset(
    $_POST[$post_name])) { 
       
    $sql "INSERT INTO Sales (No_Brought) VALUES ('$_POST[$post_name]')"
       print 
    "The number are: " .$_POST[$post_name]. ". "

    in the first line, inside the WHILE loop, instead of doing the print statement, try simply echoing out the entire $sql variable that is being created in there. do it with a "<br/>" linebreak at the end of the query, and see what that pumps out, then post back with the results...

    Sorry for the delay in this, but if you can stick msn on, it might be easier to solve mano-a-mano...
    before you judge someone, you should walk a mile in their shoes. That way, when you judge them, you're a mile away, and you have their shoes...
    "A lack of planning on your part does not constitute an emergency on mine" - Danonthemoon
    She asked for a double entendre, so I gave her one...
    "screw ie. it can lick my balls" - A.J. Cates

  14. #14
    Thanks for getting back to me. I tried your suggestion about doing an echo statment of the $sql instead of the print. Here is what the code looked like (just to make sure that I did indeed try what you were saying and that I didn't misundertand):

    Code:
    if ($act == 'update') {
        $sql_result = mysql_query($sql,$connection) or die ('Could not select');
        while( $row = mysql_fetch_array($sql_result)) {
     $post_name = "nobrought_" . $row[0];
      if (isset($_POST[$post_name])) {
       $sql = "INSERT INTO Sales (No_Brought) VALUES ('$_POST[$post_name]')";
       echo "This is what is echoing: " .$sql. "!<br/>";
      }
     }
    }
    When I clicked on the submit button, it still only INSERTed the last (in this case the 14th) line and here is what the echo statement displayed:

    This is what is echoing: INSERT INTO Sales (No_Brought) VALUES ('1')!
    This is what is echoing: INSERT INTO Sales (No_Brought) VALUES ('2')!
    This is what is echoing: INSERT INTO Sales (No_Brought) VALUES ('3')!
    This is what is echoing: INSERT INTO Sales (No_Brought) VALUES ('4')!
    This is what is echoing: INSERT INTO Sales (No_Brought) VALUES ('5')!
    This is what is echoing: INSERT INTO Sales (No_Brought) VALUES ('6')!
    This is what is echoing: INSERT INTO Sales (No_Brought) VALUES ('7')!
    This is what is echoing: INSERT INTO Sales (No_Brought) VALUES ('8')!
    This is what is echoing: INSERT INTO Sales (No_Brought) VALUES ('9')!
    This is what is echoing: INSERT INTO Sales (No_Brought) VALUES ('10')!
    This is what is echoing: INSERT INTO Sales (No_Brought) VALUES ('11')!
    This is what is echoing: INSERT INTO Sales (No_Brought) VALUES ('12')!
    This is what is echoing: INSERT INTO Sales (No_Brought) VALUES ('13')!
    This is what is echoing: INSERT INTO Sales (No_Brought) VALUES ('14')!

    For some reason, only that value of 14 is inserting. Is there a different angle that I should try to tackle this problem from?

    Thanks again.

    -- Dan

  15. #15
    biznuge's Avatar
    1,136
    posts
    Use the Fork Luke...
    i'v e just had around 8-10 pints of some lager called, i think, "paulina/", or something, so best bet might be me having a look tomorrow. lol.

    well done with trying the traceout though. debbuging rules!!!!! Woot!
    before you judge someone, you should walk a mile in their shoes. That way, when you judge them, you're a mile away, and you have their shoes...
    "A lack of planning on your part does not constitute an emergency on mine" - Danonthemoon
    She asked for a double entendre, so I gave her one...
    "screw ie. it can lick my balls" - A.J. Cates

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012