I have a list of organizations in a DDL where the Text displays the full name of each organization and the Value is the key for that organization. I need both the full name and the key entered into my database when an organization is selected. I have been unable to access both the Value and the Text using PHP, so I ended up stringing the full name and key together in the Value field and using Explode to split them into different variables (see below). Is this the best way to do this? I want to make sure I'm not overlooking something cleaner and simpler.
HTML:
<form method="post" action="submit.php" name="requestDetailsForm">
<label>Organization Name:</label>
<select id="org_name" name="org_name">
<option value="Organization 1.abc">Organization 1</option>
<option value="Organization 2.def">Organization 2</option>
</select>
<input type="Submit" value="Submit">
</form>
PHP:
<?php
$org_name = mysql_escape_string($_POST['org_name']);
$org_name_split = explode('.', $org_name);
$org_name_full = $org_name_split[0];
$org_name_key = $org_name_split[1];
$strSQL = "INSERT INTO Database(org_name_full, org_name_key) VALUES ('$org_name_full', '$org_name_key')";
?>