By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,967 Members | 1,740 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,967 IT Pros & Developers. It's quick & easy.

here i want to transfer multiple textbox box in a mysql database using php coding...

P: 1
<?php
$connection=mysql_connect("localhost","root") or die( mysql_error() );

mysql_select_db("studentmgmt",$connection )or die( mysql_error());

$res=mysql_query("select * from studentmgmt.add where deptt='I.T'");
$id='';
echo"<br><br><br><br><br>";
echo"<table align='center' border='1'>";
echo"<form method='post' action=''>";
echo"<th>Name</th><th>Roll no</th><th>Attendence</th>";
while($row=mysql_fetch_array($res))
{
echo"<tr><td>$row[name]</td><td>$row[rollno]</td><td><input type='text' name='at[]'></td></tr>";
}
echo"<tr><td><input type='submit' name='submit'></td></tr>";
echo"</form>";
echo"</table>";

if($_REQUEST['submit'])
{
$attendence[]=$_REQUEST['at[]'];
mysql_query("insert into studentmgmt.attendenceit(name,rollno) select name,rollno from studentmgmt.add where deptt='I.T'")or die(mysql_error());
mysql_query("insert into studentmgmt.attendenceit(attendence) values('$attendence[]'") or die(mysql_error());
$res=mysql_query("select * from studentmgmt.attendenceit");

/*for($i=0;$i<=mysql_num_rows($res);$i++)
//while($row=mysql_fetch_array($res))
{
$attendence[$i]=$_REQUEST['at[$row]'];
mysql_query("update studentmgmt.attendenceit set attendence='$attendence[$i]'")
or die(mysql_error());
}*/
}

?>
Nov 28 '11 #1
Share this Question
Share on Google+
1 Reply


omerbutt
100+
P: 638
Hi ,
please use [code] tags to wrap your code inside , and whats the problem with the above code, what errors are you facing any detail,you must provide sufficent detail while asking a question and please read the Please Read Before Posting - Forum Etiquette & Useful Stuff once before posting a question.
regards,
Omer Aslam
Nov 28 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.