I have adauga_tablou_db.php who contain this php script:
<html>
<head>
<link rel="stylesheet" href="/style/MYSTYLE.CSS" type="text/css">
<meta name="verify-v1" content="52vQ/BcSvsm6MlAsynpikrmlr2b9x0Q5Xam38QWYKcc=" >
</head>
<body>
<table bgcolor="#ffffff" width="100%" height="100%" align="center" border="0"><tbody valign="top"><tr><td width="100%" height="100%" align="center">
<form name="formular" action="adauga_tablou_db.php" method="POST"><table><tbody valign="top"><tr><td><p>Nume tablou</p></td><td><input type="text" name="nume_tablou" /></td><td></tr>
<tr><td><p>Numar inregistrari</p></td><td><input type="text" name="numar_inregistrari" /></td><td></tr>
<tr><td></td><td><input type="submit" name="adauga_tablou" value="Adaugă"/><input type="reset" name="reset" value="Şterge" /></td></tr></tbody></table></form>
<?php
$nume_tablou=$_POST['nume_tablou'];
$numar_inregistrari=$_POST['numar_inregistrari'];
$daniel = fopen("logare.daniel","r") ;
$citeste = fscanf ($daniel, "%s\t%s\t%s\t%s") ;
list ($h,$u,$p,$d) = $citeste;
$host=$h; // Host name
$username=$u; // Mysql username
$password=$p; // Mysql password
$db_name=$d; // Database name
mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB");
/*$creaza_tablou=mysql_query("CREATE TABLE Metatag(CelCareNumaraTotTimpul INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(CelCareNumaraTotTimpul),
metataguri VARCHAR(40000))");
if(!$creaza_tablou){ echo"<br />Nu s-a creat tabloul!".mysql_error(); }
else{echo"<br />S-a creat tabloul!";}*/
fclose($daniel);
if(isset($_POST['adauga_tablou'])){
$nume_tablou=$_POST['nume_tablou'];
$numar_inregistrari=$_POST['numar_inregistrari'];
$scrie=fopen("numar_inregistrari.dan","w");
$scrie=fwrite($scrie,"%d".$numar_inregistrari);
echo"<p><small>Numar inreg:".$numar_inregistrari."</small><br />";
if(empty($nume_tablou) || empty($numar_inregistrari)){ die('Sărăcie la completare!');}
echo"<form name='formular1' action='adauga_tablou_db.php' method='POST'><table><tbody><tr><td></td><td><p><b>Nume inregistrare</b></p></td><td><p><b>Tipul inregistrarii</b></p></td><td><p><b>Lungimea Inregistrarii<input type='hidden' name='fantoma' value='".$numar_inregistrari."' /></b></p></td></tr>";
for($i=1;$i<=$numar_inregistrari;$i++){
echo"<tr><td><p><b>".$i."</b></p></td><td><input type='text' name='nume_inregistrare".$i."' /></td><td><select name='tip_inregistrare".$i."'><option value='1'>INT</option><option value='2'>VARCHAR</option><option value='3'>TEXT</option><option value='4'>DATE</option></select></td><td><input type='text' name='lungime_inregistrare".$i."' /></td></tr>";}
echo"<tr><td></td><td><input type='submit' name='adauga_tablou1' value='Adauga tablou' /><input type='reset' name='sterge' value='Sterge tot' /></td></tr></tbody></table></form>";
fclose($scrie);
}
if (isset($_POST['adauga_tablou1'])) {
$fantoma=$_POST['fantoma'];
echo"fantoma=".$fantoma;
for($l=1;$l<=$fantoma;$l++){
echo"<br />Numar inregistrare ".$l."-->".$_POST['nume_inregistrare.[$l].'];
}
}
?>
</td></tr></tbody></table>
</body></html>
Ok.The problem appear when i press the buton "adauga_tabloul" who's a submit button: i cannot read the values of text fields and the values of select tag from "formular1".The "formular1" is this (from php script from above):
echo"<form name='formular1' action='adauga_tablou_db.php' method='POST'><table><tbody><tr><td></td><td><p><b>Nume inregistrare</b></p></td><td><p><b>Tipul inregistrarii</b></p></td><td><p><b>Lungimea Inregistrarii<input type='hidden' name='fantoma' value='".$numar_inregistrari."' /></b></p></td></tr>";
for($i=1;$i<=$numar_inregistrari;$i++){
echo"<tr><td><p><b>".$i."</b></p></td><td><input type='text' name='nume_inregistrare".$i."' /></td><td><select name='tip_inregistrare".$i."'><option value='1'>INT</option><option value='2'>VARCHAR</option><option value='3'>TEXT</option><option value='4'>DATE</option></select></td><td><input type='text' name='lungime_inregistrare".$i."' /></td></tr>";}
echo"<tr><td></td><td><input type='submit' name='adauga_tablou1' value='Adauga tablou' /><input type='reset' name='sterge' value='Sterge tot' /></td></tr></tbody></table></form>";
Now when press the button "adauga_tablou1" nothing is happen.I try in the follow script to read only values of text fields named "nume_inregistrare", but the values cannot appear:
if (isset($_POST['adauga_tablou1'])) {
$fantoma=$_POST['fantoma'];
echo"fantoma=".$fantoma;
for($l=1;$l<=$fantoma;$l++){
echo"<br />Numar inregistrare ".$l."-->".$_POST['nume_inregistrare'][$l];
}
}
If you have an idea for this problem please answer.I need a solution very quickly.Thanks a lot