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:
and then if successful the variable $fetched would contain
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
Re: Help with regex (search/replace) please
am 08.02.2010 16:48:35 von Gautam Bhatia
hello,
Hi ryan, i am not sure i am getting you on what ya want , is this
something like what ya want, the code below which i wrote?
function get_value()
{
var el = document.form_name.elements.length;
for(var i =0 ; i<= el ; i++)
{
if(document.form_name.elements[i].type="checkbox")
{
var id = document.form_name.elements[i].getAttribute("id");
var name = document.form_name.elements[i].getAttribute("name");
var functions =
document.form_name.elements[i].getAttribute("onsomething");
var full_field = ("you can join all 3 ^^ values to make the full code
and pass that to php script via ajax , Other methods are welcome too ');
}
}
}
Regards,
Gautam Bhatia
On Sat, 2010-02-06 at 07:41 -0800, Ryan S 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:
>
>
>
>
> 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
>
> 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