html - PHP get selected text from select box and get the email -
for receiving in email account values want text selection how here code :
<select name="selectoption"> <option value='0'>choose server..</option> <option value='1'>l2 empireage 70x</option> <option value='2'>l2 empireage warfire 150x</option> <option value='3'>l2 empireage classic 30x</option> </select> $name = $_post['name']; $email_address = $_post['email']; $password = $_post['password']; $select_server = $_post['selectoption']; $select_weapon = $_post['weaponid']; $to = $myemail; $email_subject = "contact form submission: $name"; $email_body = "you have received new message. /n ". " here details:\n name: $name \n email: $email_address \n password: $password \n server_id: $select_server \n weapon_id: $select_weapon ";
you need array store values, see example:
<?php $array[0] = 'choose server..'; $array[1] = 'l2 empireage 70x'; $array[2] = 'l2 empireage warfire 150x'; $array[3] = 'l2 empireage classic 30x'; ?> <select name="selectoption"> <?php for($i = 0; $i < count($array); $i++) { echo "<option value='{$i}'>{$array[$i]}</option>"; } ?> </select> $name = $_post['name']; $email_address = $_post['email']; $password = $_post['password']; $select_server = $_post['selectoption']; $select_weapon = $_post['weaponid']; //your server info here $info = $array[$select_server];
Comments
Post a Comment