Results 1 to 4 of 4

Thread: posting a form

  1. #1
    Join Date
    Mar 2004
    Posts
    5

    Unanswered: posting a form

    is there any way to make a form post more then once when you click submit. basically make 2 records in the same table with one click, or 3, or 4?

  2. #2
    Join Date
    Apr 2004
    Location
    NC
    Posts
    2
    You could use a for loop
    PHP Code:
    for($i=1$i<=$var$i++){
    //put your insert stuff here


  3. #3
    Join Date
    Jun 2003
    Location
    Minnesota
    Posts
    61
    or If its not to many records you could just make separate insert statments.
    Mr. Lars

  4. #4
    Join Date
    Mar 2004
    Posts
    5
    see, thats the problem, I am trying to make it so they type in the number of records they want on the previous page, as well as all the information, then post that information the number of times they selected.

    my best try has been

    $i = $HTTP_GET_VARS['numberofloads'];
    if ($i >= 1){
    $i = ($i-1);
    $insertSQL = sprintf("INSERT INTO contractbyload (pcpcondatesold, pcpbrokernum, pcpbuyernum, pcpconcropyear, pcpalmvariety, pcpalmgrade, pcpalmsize, pcpalmsizecat, pcpcontainersize, pcpnetweight) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
    GetSQLValueString($HTTP_POST_VARS['datesold'], "date"),
    GetSQLValueString($HTTP_POST_VARS['broker'], "text"),
    GetSQLValueString($HTTP_POST_VARS['buyer'], "text"),
    GetSQLValueString($HTTP_POST_VARS['cropyear'], "text"),
    GetSQLValueString($HTTP_POST_VARS['variety'], "text"),
    GetSQLValueString($HTTP_POST_VARS['grade'], "text"),
    GetSQLValueString($HTTP_POST_VARS['size'], "text"),
    GetSQLValueString($HTTP_POST_VARS['sizecat'], "text"),
    GetSQLValueString($HTTP_POST_VARS['contsize'], "text"),
    GetSQLValueString($HTTP_POST_VARS['netweight'], "int"));

    mysql_select_db($database_archaven, $archaven);
    $Result1 = mysql_query($insertSQL, $archaven) or die(mysql_error());
    }
    Else{
    $insertGoTo = "contractinsert.php";

    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];

    header(sprintf("Location: %s", $insertGoTo));

    }

    I screwed up somewhere because that just plain out does nothing.
    Last edited by causeidm; 04-11-04 at 04:27.

Posting Permissions

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