PHP Grab data element

Is there a way to grab the data element from a select menu?

<?php if(isset($_POST data="state)) { do something}
<html>
<option name="bike_state" data-state='.$row->state.'" class="option-center" value="'.$row->id.'" >'.$row->state.'</option>
</html>

Open in new window

LVL 8
rgranlundAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
That doesn't make any sense besides being too incomplete to be meaningful.  That is not what I just showed you to create the 'if(isset...' statement.  You must identify the $_POST item you want by using an 'index' like $_POST['item'].
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ray PaseurCommented:
http://iconoun.com/demo/temp_rgranlund.php

<?php // demo/temp_rgranlund.php
/**
 * See http://www.experts-exchange.com/Programming/Languages/Scripting/PHP/Q_28629555.html
 *
 * Process HTML Select Options in PHP
 *
 */
error_reporting(E_ALL);
ini_set('display_errors', TRUE);

// IF THERE HAS BEEN A POST-METHOD REQUEST
if (!empty($_POST['thing']))
{
    echo "THE SELECTED OPTION IS: " . $_POST['thing'];
}

// CREATE AN HTML FORM WITH A SELECT CONTROL
$form = <<<ENDFORM
<form method="post">
<select name="thing">
<option value="">Please Choose</option>
<option value="1">One</option>
<option value="2">Two</option>
</select>
<input type="submit" />
</form>
ENDFORM;

echo $form;

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.