ali_2kool2002 Posted March 9, 2007 Share Posted March 9, 2007 Hi does anyone know how to retrieve a record say from an sql database and then make editing on the same output and save it back into the same record? I.e. i want to display all the records of a table but have an extra radio button, and when this radio button is selected along side it i want to know which record id number has been selected. The user can select more than one record and then click submit button. could any one code a simple example which i could use to do this? --------------------------------------------------------------------- i think i need somthing like this but dont know how in php? :'( SQL QUERY>> SELECT * FROM TABLE while there are results for the query{ show record Display radio button next to it (<input type="radio" name="driverId" value = '.$driverId.' checked> Selected ) } submit button Link to comment https://forums.phpfreaks.com/topic/41981-solved-editing-records-not-sure/ Share on other sites More sharing options...
interpim Posted March 9, 2007 Share Posted March 9, 2007 count rows of db first... set up a while loop to write until the number of rows is reached, such as $i=0; while($i<$num_rows){ write row with radio button value=$i; $i++; } Link to comment https://forums.phpfreaks.com/topic/41981-solved-editing-records-not-sure/#findComment-203556 Share on other sites More sharing options...
redarrow Posted March 9, 2007 Share Posted March 9, 2007 <?php if($_POST['submit']){ echo $key; } $x=array("a" => "a was seleted" , "b" => "b was selected" , "c" => "c was selected"); echo"<form method='POST' action=''>"; foreach ($x as $key => $value){ echo"<input type='radio' name='key' value='$value'>$key<br>"; } echo"<br><input type='submit' name='submit' value='GET ME'>"; ?> Link to comment https://forums.phpfreaks.com/topic/41981-solved-editing-records-not-sure/#findComment-203560 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.