Jump to content

coder500

Members
  • Posts

    55
  • Joined

  • Last visited

    Never

Everything posted by coder500

  1. Hi It worked. But one more doubt.. I want to enter multiple fields, then how will it be/ I used foreach ($_POST['check'] AS $value) { $email=$_POST['email']; $query=mysql_query("INSERT INTO tb_signup (userid,email) VALUES ('$value','$email')"); } But it inserts 'array' instead of email. Any help, please...
  2. Hi bretticus , Thanks for the hint. But I could not solve it . I am posting my code here. Can you make a quick look and correct it please... <form id="form1" name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" > <label>Number of rows to be inserted <input type="text" name="num_rec" /> </label> <label> <input type="submit" name="display" value="Display" /> </label> <p> </p> </form> <form name="form2" enctype="multipart/form-data" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <?php $num_rec = $_POST['num_rec']; for($x=0;$x<$num_rec;$x++){ ?> <input type="text" name="check" /> <? // end of for loop } ?> <p> <input type="submit" name="Insert" value="Insert"> </p> </form> <?php $db = mysql_connect ( "" , "" , "" )or die('Cannot connect to the database because: ' . mysql_error()); mysql_select_db (""); foreach ($_POST['check'] AS $value) { $query=mysql_query("INSERT INTO tb_signup (userid) VALUES ('$value')"); } mysql_close($db); ?>
  3. I want to insert multiple records to the database at the same time. First I need to enter the number of records to be inserted. Depending on the number of records to be inserted <input type="text"> should come After entering all records , they need to be inserted in the database. I am looking for an option that can be done using single PHP page. Is it possible? Any help !
×
×
  • 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.