Welcome Guest, Not a member yet? Register   Sign In
How to get to split the select value Question
#2

(This post was last modified: 01-15-2016, 10:00 PM by John_Betong. Edit Reason: added output )

(01-15-2016, 05:16 PM)wolfgang1983 Wrote: On my select drop down value I have it producing some thing like

Code:
<option value="codepen/4">Codepen RSS Feed > Home Page</option>

And code pen is "code" and 4 is id.

My question is how on my function could I be able to get the name and id seperate 


Try this:
Code:
echo '<br />$val => ',
    $val = $val = 'codepen/4';     // codepen/4

echo '<br />';
echo '<br />$code => ',
    $code = strstr($val, '/', true);     // codepen
echo '<br />$tmp => ',
    $tmp = strstr($val, '/', false);     // /4
echo '<br />$module_id => ',
    $module_id = substr($tmp, 1);     // /4
Output:

$val => codepen/4

$code => codepen
$tmp => /4
$module_id => 4
Reply


Messages In This Thread
RE: How to get to split the select value Question - by John_Betong - 01-15-2016, 09:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB