php - Use javascript run select option in MySQL query -


i have select box linked through js. i'm trying make option chosen saved, when 'refresh attendees' clicked, attendees selected group refreshed.

select box

<select name="users" onchange="showyes(this.value); showno(this.value); showun(this.value);" style="font-size: 14px; font-family: open-sans,sans-serif; font-weight: 700; line-height: 17px;" id="attactivity">           <option value="">select activity</option>           <option value="cma">cma</option>           <option value="cm2">cm2</option>           <option value="cmb">cmb</option>           <option value="cpm">cmp</option> 

mysql

    $refreshatt = mysql_real_escape_string($_post['refreshatt']);     $attactivity= mysql_real_escape_string($_post['attactivity']);     // see if product name identical match product in system      $sql = mysql_query("update stats set attend='0' activity='attactivity'");     header("location: admin-page.php");      exit(); } ?> 

right now, not getting attactivity, no group being refreshed. suggestions?

as heads-up: have tried query stating group (i.e. cma, cm2, etc) , works. seems getting value of 'attactivity'

assuming posting form data correctly, issue query. have insert literal attactivity instead of variable.

$sql = mysql_query("update stats set attend='0' activity='attactivity'"); 

vs.

$sql = mysql_query("update stats set attend='0' activity='$attactivity'"); 

additional recommendations:


Comments