alin19 Posted May 19, 2008 Share Posted May 19, 2008 in this part: $cerD="SELECT `Id_bo` FROM `date_clienti` order by `Id_bo` desc"; $cerDA=mysql_query($cerD); while ($cerereDE=mysql_fetch_array($cerDA)) { echo "<tr><td><input type=submit name=client value=$cerereDE[0]></td></tr>"; } when i click on any of the resulted butons i will get the $_POST['client']== last value in the database for example i will have the butons: IO23 OP10 IA92 IK89 no mater what i click $_POST['client']=='IK89' what can i do to get the value of the clicked buton? <html> <body> <form name=modif method=POST> <table border=1> <?php $hostname="localhost"; $username="root"; $password="tractor"; $database="apelmarja"; $conexiune=mysql_connect($hostname,$username,$password) or die ("Nu ma pot conecta la baza de date"); $bazadate=mysql_select_db($database,$conexiune) or die ("Nu gasesc baza de date"); $cerD="SELECT `Id_bo` FROM `date_clienti` order by `Id_bo` desc"; $cerDA=mysql_query($cerD); while ($cerereDE=mysql_fetch_array($cerDA)) { echo "<tr><td><input type=submit name=client value=$cerereDE[0]></td></tr>"; $id_bo=$cerereDE[0]; $cerC="SELECT `nr_contract` , `activ` FROM `conturi` where `Id_bo`='$id_bo' "; $cerCA=mysql_query($cerC); while ($cerereCE=mysql_fetch_array($cerCA)) { echo "<tr><td></td><td><input type=submit name=contract value=$cerereDE[0]-$cerereCE[0]"; if ($cerereCE[1]=='Nu') echo ' disabled'; echo "></td></tr>"; } } echo "</table>"; if (isset ($_POST['client'])) { echo "<table border=2>"; $id_bo_C=$_POST['client']; $cVDateCl="SELECT * FROM `date_clienti` WHERE `Id_bo`='$id_bo' limit 1;"; $cVDateClA=mysql_query($cVDateCl); $cVDateClE=mysql_fetch_array($cVDateClA); $cnp=$cVDateClE['Cnp']; $nume=$cVDateClE['Nume_prenume']; $serie_bi=$cVDateClE['Serie_BI']; echo "<tr><td><input type=text value=$cnp </td></tr>"; echo "<tr><td><input type=text value=$nume </td></tr>"; echo "<tr><td><input type=text value=$serie_bi </td></tr>"; echo "</table>"; } ?> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/106285-solved-geting-only-the-last-value/ Share on other sites More sharing options...
alin19 Posted May 19, 2008 Author Share Posted May 19, 2008 solve it, sorry Link to comment https://forums.phpfreaks.com/topic/106285-solved-geting-only-the-last-value/#findComment-544691 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.