Best wey to pass data selected from an option tag
Posted: Thu May 06, 2010 9:24 am
I am looking for some advise on the best way to pass a piece of data to a second page that comes from a option group.
I think an example will explain better than i can.
when the user submits the form i want to be able to pass the value for the selected name but not show it on the form. Any thoughts?
Thanks in advance.
I think an example will explain better than i can.
Code: Select all
<form name="alter" method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
<div class="form">Choose a name to delete. <select name="delete">
<?php
$user_id = $_SESSION['user_id'];
$result = mysql_query("SELECT * FROM contact_name WHERE user_id = '$user_id'");
while ($row = mysql_fetch_array($result)) {
echo "<option>" . $row['fname'] . " " . $row['lname'] . "</option>";
} ?>
</select>
</div>
</form>
</div>
<div class="form"><input name="submit" type="submit" value="Delete" /><input name="reset" type="reset" value="Reset" /></div>
</form>
Code: Select all
$row['contact_id']Thanks in advance.