tags:

views:

61

answers:

1

how do i disable an html element after checking in php if it exists? in other words, after the data has been inserted into the xml file the first time, the html textbox elements should be disabled, so that the user does not enter any more information in that textbox.

is this possible?

the code checks if the element exists, and if it does, it skips the code, but i would like the html element to be disabled altogether if the element exists:

if ($xmldoc->getElementsByTagName("title")->length == 0) {
/* Arabic */
  $el_title_ar = $xmldoc->createElement('title'); 
  $root->appendChild($el_title_ar);

$text_title_ar = $xmldoc->createTextNode($title_ar);
$el_title_ar->appendChild($text_title_ar);

$el_title_ar->setAttribute('xml:lang', 'ar');
/* Arabic */

/* English */
$el_title_en = $xmldoc->createElement('title'); 
    $root->appendChild($el_title_en);

$text_title_en = $xmldoc->createTextNode($title_en);
$el_title_en->appendChild($text_title_en);

$el_title_en->setAttribute('xml:lang', 'en');
/* English */
}
+1  A: 

I think it's any but definatly tfor textboxes you can put a disabled keyword in the tag like so.

<input id="myTextbox" type="text" value="something" DISABLED>

For your php page you could do something like this.

<input id="myTextbox" type="text" value="something" <?php if(whatever_exists) echo 'DISABLED'; ?>>

Hope this helps.

Ash Burlaczenko
If you are working with XHTML, you want to use `disabled="disabled"`.
Andrew Moore
Cheers. Didn't know that. I haven't done much XHTML but I'll make sure I store that info somewhere safe :P. Thanks.
Ash Burlaczenko
thanks for this. but my code is in a different page, so how would i pass the php parameter of 'if this exists' to the html page?
fuz3d