Perad Posted May 11, 2010 Share Posted May 11, 2010 I have the following bit of XML. <contactform> <label1 check="1" textarea="0">Name</label1> <label2 check="1" textarea="0">Address</label2> <label3 check="1" textarea="0">Email</label3> <label4 check="0" textarea="0">Phone</label4> <label5 check="0" textarea="0">Cell</label5> <label6 check="0" textarea="0">Comments</label6> </contactform> I need to get back the following. Label Name = Name Textarea = 0 Field Name = label1 The problem I have is getting the fieldname. How do I retrieve this? <?php foreach($contactform->children() as $label): ?> <label><?php echo $label; ?></label> <?php if ($label['textarea'] == 1): ?> <textarea name=""></textarea> <?php else: ?> <input type="text" name="" /> <?php endif; ?> <?php endforeach; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.