|
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)...should it be some problem with the encoding?
here`s the databse code(and thanks a lot)
<?php
if(isset($_POST['submit']))
{
$national=$_POST['Nationalnum'];
$account=$_POST['Accountnum'];
$wifename=$_POST['Wifename'];
$surname=$_POST['Surname'];
$parent=$_POST['Parentname'];
}
$db = mysql_connect("localhost","administrator", "")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($query) or die (mysql_error());
$query = "select * from $table_name";
$result = mysql_query($query);
$num_rows=mysql_num_rows($result);
$num_fields = mysql_num_fields($result);
//create table header
echo "<table border = 1>";
echo "<tr>";
for ($i=0; $i<$num_fields; $i++)
{
echo "<th>";
echo mysql_field_name ($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_type ($result, $i) . "<br> \n";
echo "(" . mysql_field_len ($result, $i) . ")<br> \n";
echo mysql_field_flags ($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);
?>
|