Jump to content

Murtaza66

New Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by Murtaza66

  1. foreach($_POST['Producten'] as $row=>$data){ $Producten = mysql_real_escape_string($data); $ProdOms = mysql_real_escape_string($_POST['ProdOms'][$row]); $Aantal = mysql_real_escape_string($_POST['Aantal'][$row]); $Prijs = mysql_real_escape_string($_POST['Prijs'][$row]); $row_data[] = "('$Producten','$ProdOms','$Aantal','$Prijs')"; //var_dump("INSERT into hulptabel (ID, FactuurNR, Product,ProdOms,Aantal, Prijs) VALUES ('$ID','$FactuurNR' ,'$Producten','$ProdOms','$Aantal','$Prijs')"); $sql= mysql_query("INSERT into hulptabel (ID, FactuurNR, Product,ProdOms,Aantal, Prijs) VALUES ('$ID','$FactuurNR' ,'$Producten','$ProdOms','$Aantal','$Prijs')"); } } this is the php script what I have know ps. why show var_dump at the good way i.e two query's en mysql_query not
  2. Hello guys, I have a question about how to insert a multiple query into database i have the following html form <div class="input_fields_wrap"> <button id="remove_field">x</button> <?php $query = mysql_query("SELECT * FROM producten"); ?> <select name="Producten[]" id="Producten"> <div><?php while($row = mysql_fetch_array($query)){ echo "<option>" . $row['Producten'] . "</option>"; }?> </div><input type="text" name="ProdOms[]"> <input type="text" size="3" name="Aantal[]"> <input type="text" size="3" name="Prijs[]"> <a href="javascript:void(0)" onclick="toggle_visibility('popup-box1');"><img src="../img/icons/info.png" height="16" width="16"></a> </select> </div> So this is the html form what I'm using i have 15 of these. It deppents how much the user would like too use for example he/she want to use 2 form like this fill it in and insert into the database.
  3. thanks rwhite35 but what if the user fills 2 form how to get the value of them I thought using a foreach statement like this $row_data = array(); foreach($_POST['Producten'] as $row=>$data){ $Producten = mysql_real_escape_string($data); $ProdOms = mysql_real_escape_string($_POST['ProdOms'][$row]); $Aantal = mysql_real_escape_string($_POST['Aantal'][$row]); $Prijs = mysql_real_escape_string($_POST['Prijs'][$row]); $row_data[] = "('$Producten','$ProdOms','$Aantal','$Prijs')"; $sql = mysql_query("INSERT into hulptabel (ID, FactuurNR, Product,ProdOms,Aantal, Prijs) VALUES ('$ID','$FactuurNR' ,'$Producten','$ProdOms','$Aantal','$Prijs')"); } But when I wants to insert more then 2 rows it will insert only 1 row
  4. Hello everyone, I'm working on a project for school. It's an invoice program but I'm stuck, can anyone help me figure out how to get the values out of multiple textboxes /fields and insert them in to my database. This is what it looks like. The user can select the amount of textfields that will be inserted in to the database. <div class="input_fields_wrap"> <button id="remove_field">x</button> <?php $query = mysql_query("SELECT * FROM producten"); ?> <select name="Producten[]" id="Producten"> <div><?php while($row = mysql_fetch_array($query)){ echo "<option>" . $row['Producten'] . "</option>"; }?> </div><input type="text" name="ProdOms[]"> <input type="text" size="3" name="Aantal[]"> <input type="text" size="3" name="Prijs[]"> <a href="javascript:void(0)" onclick="toggle_visibility('popup-box1');"><img src="../img/icons/info.png" height="16" width="16"></a> </select> </div> this is my html form I have 15 of these how to insert the values in the database
×
×
  • 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.