Jump to content

AliceC04

New Members
  • Posts

    1
  • Joined

  • Last visited

AliceC04's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, Im new here, I had read some of your post in order to find what im looking for... here is my issue: Im using php and mysql (the mysql table have 2 foreign keys) I have a form with some checkboxes, this section is filled with a select because the items are from another table so my problem is when I try to do the insert in the database, the problem are the checkboxes and I really dont know how can i get the values or how can i solve my problem. This Is how I print the list of items in checkboxes <p><label>career:</label></p> <table border="0"><td><p><? $sql = "SELECT * FROM career ORDER BY id_career asc"; $res = mysql_query($sql); $c=0; while($row = mysql_fetch_assoc($res)){ $vector[$c] = $row['career']; $c++; } for($f=0;$f<$c;$f++){ ?> <input type="checkbox" name="career[]" id="career[]" value="<? echo $career; ?>"> <? $career= $vector[$f]; echo $vector[$f]; echo "<br>";}?></p> </td></table> Then my form have an action=" " but is conected to 'function save' (is where i have my php code) <? function save_career($name,$gender,$status,$id_client,$id_career){ $name=$_POST['name']; $gender=$_POST['gender']; $status="inactive"; $query = "insert into career(id_career,name,gender,status,id_client,id_career) values(0, '$name','$gender','$status',$id_client,$id_career)"; mysql_query($query); echo $query; } ?> I hope someone can help me because i tried lots of ways to solve this... Greetings!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.