Link to home
Start Free TrialLog in
Avatar of cappleg8
cappleg8

asked on

PHP MySQL using radio button onClick to update database

I'm using Dreamweaver, PHP & MySQL in a website for my company.  I have created an In/Out board for the company but now want to have it where you can click on a radio button and have it update the status of the employee.  There are 6 different places that the person can be and I have set the radio buttons' value to correspond with the StatusID for that place.  What do I need to do to finish the system of having it update without a submit button but automatically updating when the button is clicked.  The page refreshes so that it doesn't time out. If the status doesn't update when clicked, the changes will be lost when the page refreshes.  Currently, we manually change the status on a different page but would like to cut out the extra time it takes.
Avatar of paulp75
paulp75
Flag of Australia image

You would need to set this up with javascript. I would suggest checking out jquery.com
I have found them to be the easiest to use.
ASKER CERTIFIED SOLUTION
Avatar of cappleg8
cappleg8

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of khurshid
khurshid

I'm not sure if you ever got the correct answer here.
<form id="form1" name="form1" method="post" action="locprocess.php">
  <label>
  <input name="radiobutton" type="radio" value="canteen" onchange="this.form.submit();"/>
    canteen</label>
  <p>
    <label>
    <input name="radiobutton" type="radio" value="quarters" onchange="this.form.submit();" />
    quarters</label>
  </p>
  <p>
    <label>
    <input name="radiobutton" type="radio" value="serverroom" onchange="this.form.submit();"/>
    server room</label>
  </p>
</form>

Open in new window