1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

how to strip the options value and innerhtml

Discussion in 'PHP' started by gilgalbiblewheel, Oct 23, 2008.

  1. #1
    how do I strip the options value and innerHTML?
    Well...since it's an old html code there is no </option>.
    			<option value="BJ">Benin
    
    			<option value="BM">Bermuda
    
    			<option value="BT">Bhutan
    Code (markup):
    I want to strip them so I can place them in a database table.
     
    gilgalbiblewheel, Oct 23, 2008 IP
  2. Kyosys

    Kyosys Peon

    Messages:
    226
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    explode() with "<option value=\"" and then with "\">"
     
    Kyosys, Oct 23, 2008 IP
  3. sastro

    sastro Well-Known Member

    Messages:
    214
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    105
    #3
    addslashes() function and str_replace("\n\r",'',$str);
     
    sastro, Oct 23, 2008 IP
  4. salahsoftware

    salahsoftware Peon

    Messages:
    63
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    you may also use str_pos() and substr()
     
    salahsoftware, Oct 23, 2008 IP
  5. salahsoftware

    salahsoftware Peon

    Messages:
    63
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I hope you know php programming as well because all the solutions above are in php
     
    salahsoftware, Oct 23, 2008 IP
  6. Kyosys

    Kyosys Peon

    Messages:
    226
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #6
    why would he ask this in here if he didn't know php?

    and what does addslashes have to do with this in any way possible?

    Also, what does removing newlines help?

    In conclusion, everything sastro said is bullshit
     
    Kyosys, Oct 23, 2008 IP
  7. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #7
    Use preg_match_all("/<option value=\"([A-Z]{2})\">(.+)/")
     
    Kaizoku, Oct 23, 2008 IP