Re: [PHP] Help with regex (search/replace) please

[email protected] (Phpster)
Newsgroups php.general
Message-ID <[email protected]>
Why not just pass the value in the onclick?

Onclick=doSomething(this);

Would give you simple access to all the properties of that element.

This.value would pass just the value.



Bastien

Sent from my iPod

On Feb 6, 2010, at 9:43 AM, Ryan S <[email protected]> wrote:

> Hey guys,
>
> As many of you might know, i totally suck at regex..so would really  
> appreciate some help here.
>
> Basically i have a html page with a lot of  
> textboxes,radios,checkboxes etc
> i need your help in the form of a regex so that when i give it the  
> name and value it gives me the entire code of that checkbox.
> for example here are 2 checkboxes:
>
> <input type="checkbox" name="something" value="1" />
>
> <input type="checkbox" name="something2" value="2" id="something"  
> onClick="javascript_code_etc()" onSomething="lots of js cod here()" />
>
>
>
> so if i want the second checkbox code i was thinking of something  
> like this:
>
> $the_name="something2";
> $the_value="2";
> $fetched=getCheckboxFromHTML($the_name,$the_value);
>
> and then if successful the variable $fetched would contain
> <input type="checkbox" name="something2" value="2" id="something"  
> onClick="javascript_code_etc()" onSomething="lots of js cod here()" />
>
> the idea is that i would use the contents of $fetch to add some code  
> before the end just before  the greater than symbol, and do a  
> str_replace().
>
> What do you think? Critique of my logic above too is welcome!
>
> Thanks!
> Ryan
>
>
>
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.