Checkbox, PHP & SQL -


I have a checkbox in my code that tells the user that the record < Strong> has been or not done . When the user searches a record in the database, the recorded record appears with the current record status ( complete or not ).

If the checkbox is not checked then it means that the record is not not , so I am trying to install a checkbox on one side of the record state so that the user After checking the checked checkbox checked on the check box, the value is sent to DB that the new status of the record is done

How can I do this when the following example code: (W Ryokta are shown after a search using a form)

  & lt ;? Php if (! Isset ($ _ POST ['search'])) {? & Gt; & Lt ;? Php} other {$ to = trim ($ _ POST ['old']); $ = = Trim ($ _ POST ['NEW']); $ Position = release ($ _ POST ['status'])? "And condition = 'full':" and condition = 'no' ''; $ Connection = mysql_pconnect ("HOST", "USER", "PASS") or die ("Connection failure.". Myslq_error ()); Mysql_select_db ("DBNAME") or die ("Unable to choose db." Mysql_error ()); $ Query = "SELECT *" from the dates where date & gt; = '$ s' and date & lt; = '$ by' ". $ Position "ASC from order date"; $ Result = mysql_query ($ query) or die (mysql_error ()); Echo "& lt; table class = 'table' id = 'searchResult' cell area = '0' cellpadding = '0' & gt;"; Echo "& lt; tr class = 'rowa'">  "; Echo "& lt; td class = 'col0 cell' & gt; id & lt; / td & gt;"; Echo "& lt; td class = 'col1 cell' & gt; name & lt; / td & gt;"; Echo "& lt; td class = 'col2 cell' & gt; last name & lt; / td & gt;"; Echo "& lt; td class = 'col3 cell' & gt; Place & lt; / td & gt;"; Echo "& lt; td class = 'col4 cell' & gt; station & lt; / td & gt;"; Echo "& lt; td class = 'col5 cell' & gt; phone & lt; / td & gt;"; Echo "& lt; td class = 'col6 cell' & gt; Record date & lt; / td & gt;"; Echo "& lt; td class = 'col7 cell' & gt; status & lt; / td & gt;"; Echo "& lt; / tr & gt;"; Echo "& lt; / table & gt;"; While ($ record = mysql_fetch_object ($ result)) {resonant "table table = 'table' id = 'searchResult' cell field = '0' cellpadding = '0'>; Echo "& lt; tr class = 'rowb' & gt;"; Echo "& lt; td class = 'col0 cell' & gt; $ Record-> Id. "& Lt; / td>"; Echo "& lt; td class = 'col1 cell' & gt; $ Record-> Name. "& Lt; / td>"; Echo "& lt; td class = 'col2 cell' & gt; $ Record-> last name. "& Lt; / td>"; Echo "& lt; td class = 'col3 cell' & gt; $ Record-> Place. "& Lt; / td>"; Echo "& lt; td class = 'col4 cell' & gt; $ Record-> station. "& Lt; / td>"; Echo "& lt; td class = 'col5 cell' & gt; $ Record-> Phone "& Lt; / td>"; $ Year_part_of_date = Explosion ('-', $ record-> Date); Echo "& lt; td class = 'col6 cell' & gt; $ Record-> Date "& Lt; / td>"; Echo "& lt; td class = 'col7 cell' & gt; $ Record-> Event. "& Lt; / td>"; Echo "& lt; / tr & gt;"; Echo "& lt; / table & gt;"; }}? & Gt;   



Thanks for showing me all the way: D

You mean, this way?

  echo "& lt; td class = 'col7 cell' & gt; & lt; input type = 'checkbox' name = 'status'". ($ Record-> position == 'complete'? 'Check': ''). "/> Gt; ";    

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -