php - how to link radiobuttons with enumeration? -
im making webshop assemble pc , have radiobuttons each part of computer.
example:
<form name ="formprocessor" method ="post" action ="radiobutton.php"> <input type = 'radio' name ='processor' value= 'b1'>intel® core™ i3 4130 3,4 ghzu</br> <input type = 'radio' name ='processor' value= 'b2'>intel® core™ i5 4670k 3.40 ghz </br> <input type = 'radio' name ='processor' value= 'b2'>intel® core™ i7 4770k 3.5 ghz </br> </form>
now dont know how add enumeration form.
an example of form handler:-
// submitted form data $processor = $_post['processor']; $ram = $_post['nameforramhere']; // connect mysql $con = mysqli_connect("host","user","password","database"); // check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); die(); } // insert database mysqli_query($con, "insert cart (processortype, ram) values ('$processor', '$ram')");
you can add in many variables want, assuming familiar sql. should replace nameforramhere name of radiobutton group ram selection. also, please note have put inverted commas query if want use variables. example, '$processor'
, '$ram'
shown in code above.
good luck!
Comments
Post a Comment