PDA

View Full Version : how to remove 3 letters from <option value="F-firstname" ? Simple question



toplisek
05-10-2007, 08:15 AM
Hello,
I have code for option like:


<option value="F-myname" >

$option = "'F-myname'";
$option = substr($option, 3);

How to remove it without using variable $option as I have 100 items for variables and it is hard to name variable $option each time.

Need help
thank you:)

djr33
05-10-2007, 08:26 AM
I don't understand. Can you give more info?

toplisek
05-10-2007, 09:13 AM
Hi,
thank you.
I'm sorry I was not clear. I have List box with code as above:
<option value="F-myname" >

I would like to store to variable with name like mynames without characters F- but it needs to be in List box as it is <option value="F-myname1" >

List box is like:
<select name="mynames" >
<option selected value="">Please select...
<option value="F-myname1" >Myname1</option>
...

djr33
05-10-2007, 10:06 AM
You can't just magically have the name of a variable be different.

What you could do (probably when receiving the info later, not with Javascript on the page) is split it to get the name, then save the data into the new variable and clear the old one.

toplisek
05-10-2007, 12:53 PM
Hi, I have solved, thank you