hi to all
i have some problem with fetching my form enteries. the problem is when i post some enteries through a form to a databse called 'applicant' and try to fetch and print it nothing appears.it seems that nothing has passed to the databse. but i think i`ve written the code correctly.can you please tell me what you think about my problem.there`s sth i should note:some of my text fields in the form are disabled and if the user checks sth they will be abled else no.
i`m getting these enteries in persian format(not in english)...shou ld it be some problem with the encoding?
here`s the databse code(and thanks a lot)
<?php
if(isset($_POST['submit']))
{
$national=$_POS T['Nationalnum'];
$account=$_POST['Accountnum'];
$wifename=$_POS T['Wifename'];
$surname=$_POST['Surname'];
$parent=$_POST['Parentname'];
}
$db = mysql_connect(" localhost","adm inistrator", "")or die ("Could not connect to localhost");
mysql_select_db ("applicant" , $db)or die ("Could not find the database");
$table_name ="personalinfo" ;
$query="INSERT INTO personalinfo ( nationalnum , accountnum)
VALUES ('$national', '$account')";
mysql_query($qu ery) or die (mysql_error()) ;
$query = "select * from $table_name";
$result = mysql_query($qu ery);
$num_rows=mysql _num_rows($resu lt);
$num_fields = mysql_num_field s($result);
//create table header
echo "<table border = 1>";
echo "<tr>";
for ($i=0; $i<$num_fields; $i++)
{
echo "<th>";
echo mysql_field_nam e ($result, $i);
echo "</th>";
}
echo "</tr>";
//end table header
//create table body
echo "<tr>";
for ($i=0; $i<$num_fields; $i++)
{
echo "<td valign = top>";
echo mysql_field_typ e ($result, $i) . "<br> \n";
echo "(" . mysql_field_len ($result, $i) . ")<br> \n";
echo mysql_field_fla gs ($result, $i) . "<br> \n";
echo "</td>";
}
echo "</tr>";
//*************** ****enteries*** ***************
for($j=0; $j<$num_rows; $j++)
{
echo "<tr>";
while ($row = mysql_fetch_row ($result))
{
///echo "$row['$nationalnum'] $row['$accountnum']<br />";
echo "<th>$row[0]</th> <th>$row[1]</th><br/>";
}
echo "</tr>";
}
echo "</table>";
mysql_close($db );
?>
i have some problem with fetching my form enteries. the problem is when i post some enteries through a form to a databse called 'applicant' and try to fetch and print it nothing appears.it seems that nothing has passed to the databse. but i think i`ve written the code correctly.can you please tell me what you think about my problem.there`s sth i should note:some of my text fields in the form are disabled and if the user checks sth they will be abled else no.
i`m getting these enteries in persian format(not in english)...shou ld it be some problem with the encoding?
here`s the databse code(and thanks a lot)
<?php
if(isset($_POST['submit']))
{
$national=$_POS T['Nationalnum'];
$account=$_POST['Accountnum'];
$wifename=$_POS T['Wifename'];
$surname=$_POST['Surname'];
$parent=$_POST['Parentname'];
}
$db = mysql_connect(" localhost","adm inistrator", "")or die ("Could not connect to localhost");
mysql_select_db ("applicant" , $db)or die ("Could not find the database");
$table_name ="personalinfo" ;
$query="INSERT INTO personalinfo ( nationalnum , accountnum)
VALUES ('$national', '$account')";
mysql_query($qu ery) or die (mysql_error()) ;
$query = "select * from $table_name";
$result = mysql_query($qu ery);
$num_rows=mysql _num_rows($resu lt);
$num_fields = mysql_num_field s($result);
//create table header
echo "<table border = 1>";
echo "<tr>";
for ($i=0; $i<$num_fields; $i++)
{
echo "<th>";
echo mysql_field_nam e ($result, $i);
echo "</th>";
}
echo "</tr>";
//end table header
//create table body
echo "<tr>";
for ($i=0; $i<$num_fields; $i++)
{
echo "<td valign = top>";
echo mysql_field_typ e ($result, $i) . "<br> \n";
echo "(" . mysql_field_len ($result, $i) . ")<br> \n";
echo mysql_field_fla gs ($result, $i) . "<br> \n";
echo "</td>";
}
echo "</tr>";
//*************** ****enteries*** ***************
for($j=0; $j<$num_rows; $j++)
{
echo "<tr>";
while ($row = mysql_fetch_row ($result))
{
///echo "$row['$nationalnum'] $row['$accountnum']<br />";
echo "<th>$row[0]</th> <th>$row[1]</th><br/>";
}
echo "</tr>";
}
echo "</table>";
mysql_close($db );
?>
Comment