Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to add row in table and in mysql using button or link?
    primarykey
    data
    text
    <p>I'm creating a simple database of children and their birthday.</p> <p><a href="http://jsfiddle.net/Q9T9u/3/" rel="nofollow">FIDDLE HERE</a></p> <pre><code>&lt;?php $chname1x = mysql_real_escape_string($_POST["chname1"]); $chbdate1x = mysql_real_escape_string($_POST["chbdate1"]); $chname2x = mysql_real_escape_string($_POST["chname2"]); $chbdate2x = mysql_real_escape_string($_POST["chbdate2"]); $chname3x = mysql_real_escape_string($_POST["chname3"]); $chbdate3x = mysql_real_escape_string($_POST["chbdate3"]); $chname4x = mysql_real_escape_string($_POST["chname4"]); $chbdate4x = mysql_real_escape_string($_POST["chbdate4"]); $chname5x = mysql_real_escape_string($_POST["chname5"]); $chbdate5x = mysql_real_escape_string($_POST["chbdate5"]); $dbhost='localhost'; $dbuser='root'; $dbpass=''; $conn=mysql_connect($dbhost,$dbuser,$dbpass) or die ('Could not connect to mysql'); $dbname='onlinepdsdb'; mysql_select_db($dbname); if ($_POST['submitbutton']) { $query="INSERT INTO children (chname1,chbdate1,chname2,chbdate2,chname3,chbdate3,chname4,chbdate4,chname5,chbdate5) VALUES ('$chname1x', '$chbdate1x','$chname2x', '$chbdate2x','$chname3x', '$chbdate3x','$chname4x', '$chbdate4x','$chname5x', '$chbdate5x')"; mysql_query($query) or die (mysql_error()); echo "The user $uid has been succesfully registered."; echo $query; echo $uid; } &lt;center&gt; &lt;form method='POST' action='formchildren.php'&gt; &lt;table border='3' style='width:700px'&gt; &lt;tr bgcolor='#3399FF'&gt; &lt;td colspan='2' class='head2' height='20'&gt;NAME OF CHILD (Write full name and list all)&lt;/td&gt; &lt;td colspan='3' class='head2' height='20'&gt;DATE OF BIRTH (mm/dd/yyyy)&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class='numbering'&gt;1.&lt;/td&gt; &lt;td style='text-align:center;'&gt; &lt;input type='text' name='chname1' size='45' maxlength='200'&gt; &lt;/td&gt; &lt;td style='text-align:center;'&gt; &lt;input type='date' name='chbdate1' size='45' maxlength='50'&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan=6 class='step' height='10'&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class='numbering'&gt;2.&lt;/td&gt; &lt;td style='text-align:center;'&gt; &lt;input type='text' name='chname2' size='45' maxlength='200'&gt; &lt;/td&gt; &lt;td style='text-align:center;'&gt; &lt;input type='date' name='chbdate2' size='45' maxlength='50'&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan=6 class='step' height='10'&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class='numbering'&gt;3.&lt;/td&gt; &lt;td style='text-align:center;'&gt; &lt;input type='text' name='chname3' size='45' maxlength='200'&gt; &lt;/td&gt; &lt;td style='text-align:center;'&gt; &lt;input type='date' name='chbdate3' size='45' maxlength='50'&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan=6 class='step' height='10'&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class='numbering'&gt;4.&lt;/td&gt; &lt;td style='text-align:center;'&gt; &lt;input type='text' name='chname4' size='45' maxlength='200'&gt; &lt;/td&gt; &lt;td style='text-align:center;'&gt; &lt;input type='date' name='chbdate4' size='45' maxlength='50'&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan=6 class='step' height='10'&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class='numbering'&gt;5.&lt;/td&gt; &lt;td style='text-align:center;'&gt; &lt;input type='text' name='chname5' size='45' maxlength='200'&gt; &lt;/td&gt; &lt;td style='text-align:center;'&gt; &lt;input type='date' name='chbdate5' size='45' maxlength='50'&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&lt;input type='SUBMIT' name='submitbutton'&gt;&lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; </code></pre> <p></p> <p>I created here a 5 rows, but if the children is more than 5 there is no more rows. I want to put a link/button that if clicked will add a row in table and in mysql but I don't have any idea how. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload