Cambiare il valore di un campo tabella con un pulsante cliccabile

Pinco Pallino

Nuovo Utente
25 Feb 2015
7
0
0
Ciao a tutti :)
Ho una tabella su db mysql, ho un pulsante per ogni riga della tabella.

PHP:
$dbhandle = mysql_connect($hostname, $username, $password) or die("Cannot connect MySQL.");
$contatore=1;
$selected = mysql_select_db("database",$dbhandle)
            or die("Cannot find the database.");

$result = mysql_query("SELECT RequestedProfession, CreateDate, CustomerName, Area, RequestedWork, TroubleReport,StatusOrder,ID_worker FROM workorder ORDER BY WorkOrder_ID ASC");


echo ("<BR><table id='report' width='100%';>

<tr>
        <td>Click on the rows to have more informations about the job: </td>
        <td></td>
        <td> </td>
        <td> </td>

         </tr><BR><BR>");


while ($row = mysql_fetch_array($result)) {

 echo ("<table id='report'; width='100%'>");

echo "<tr> <td>".$row{'RequestedProfession'}.
         "</td><td>".$row{'CreateDate'}.
         "</td><td>".$row{'Area'}.
         "</td><td>".$row{'RequestedWork'}.
		 "</td><td>".$row{'StatusOrder'}.
		 "</td><td>".$row{'ID_worker'}.

("</td></tr>");

echo "<tr><td colspan='4'><h4>Work description</h4><ul>".$row{'TroubleReport'}.

("</ul></span></td></tr><BR><Input type='button'class='myButton' name='button' value='Jag tar jobbet' $disabled >
     <BR></table>
     ");
$contatore++;
    }



mysql_close($dbhandle);



Vorrei che al click del pulsante nella relativa riga sia cambiato il valore di StatusOrder = $value e di ID_worker = $userID all'interno della tabella.
 
Ciao, quello che vedo dal codice, alla pressione del pulsante non succede assolutamente nulla... Devi dare un link con variabili in GET che devi recuperarenella stessa pagina per abilitare una query che fa l'UPDATE della tabella.
 
Grazie Filomeni, funziona :cool: Cmq ho usato il metodo get per passare le variabili a status.php da dove ho eseguito le queries.
 
Ultima modifica:

Discussioni simili