Jump to content

PHP/mysql form - multi records


raybowls

Recommended Posts

 

Fairly new to php/mysql - I am trying to set up a form to insert several records into mysql - I can get my form to do single entries but do not know how to convert it to do multi entries.

Using these codes:

 

<html><body>

 

<form action="process.php" method="post">

Number:          <input type="text" name="num" />

Shots Scores:  <input type="text" name="shots_for" />

Shots Against:  <input type="text" name="shots_against" />

Points :          <input type="text" name="points" />

<input name="submit" type="submit" value="submit">

</form>

 

</body></html>

_________________________________________________________

<html><body>

 

<?php

 

$num=$_POST['num'];

$shots_for=$_POST['shots_for'];

$shots_against=$_POST['shots_against'];

$points=$_POST['points'];

 

mysql_connect("localhost", "root", "******") or die(mysql_error());

mysql_select_db("bowls") or die(mysql_error());

 

 

mysql_query("INSERT INTO `results` VALUES ('$num', '$shots_for', '$shots_against', '$points')");

Print "Your information has been successfully added to the database.";

 

?>

 

</body></html>

 

Only being used on localhost - a long time before going live

 

Trying to learn php/mysql to build a web site for a local club I belong to.

 

Any help much appreciated

 

Ray

 

 

Link to comment
https://forums.phpfreaks.com/topic/140970-phpmysql-form-multi-records/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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