I have the following select drop-down
<select name="set_login_redirect" id="set_login_redirect">
<option value="dashboard">WordPress Dashboard</option>
<option class="level-0" value="1881">Activate</option>
<option class="level-0" value="2109">Affiliate Area</option>
<option class="level-0" value="429">Cart</option>
<option class="level-0" value="430">Checkout</option>
How do I use the PHP DomDocument class to add a new option element to the select drop-down.
For example, I want to add the code below to the HTML above.
How can it be done?
<option class="level-0" value="27">The Word</option>
with the DOM methods, i.e. createElement(), setAttribute(), appendChild().
it might be a bit easier with SimpleXML if the snippet itself conforms to the XML rules.
I eventually solved the ish using regex.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.