Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7516427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:07:43+00:00 2026-05-30T01:07:43+00:00

Can one use the php DOM class – http://php.net/manual/en/book.dom.php to generate form elements?.

  • 0

Can one use the php DOM class – http://php.net/manual/en/book.dom.php to generate form elements?.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T01:07:45+00:00Added an answer on May 30, 2026 at 1:07 am

    I tried this and works.

    <?php
        $dom = new DOMDocument('1.0', 'UTF-8');
        $dom->formatOutput = true;
        $html = $dom->createElement('html');
        $dom->appendChild($html);
    
        //head
        $head = $dom->createElement('head');
        $title = $dom->createElement('title');
        $title->nodeValue = "title of my page";
        $head->appendChild($title);
        $html->appendChild($head);
    
    
        //body
        $body = $dom->createElement('body');
        $h1 = $dom->createElement('h1');
        $h1->nodeValue = "Hello, World";
        $body->appendChild($h1);
        $html->appendChild($body);
    
        //form
        $form = $dom->createElement('form');
        $form->setAttribute("action", "");
        $form->setAttribute("method", "post");
    
       $checkbox = $dom->createElement("input");
       $checkbox->setAttribute("type", "checkbox");
       $checkbox->setAttribute("name", "myCheckbox");
       $checkbox->setAttribute("value", "someval");
       $form->appendChild($checkbox);
    
       $body->appendChild($form);
    
        echo $dom->saveHTML();
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In PHP one can use variable variables... For example... class obj { } $fieldName
Possible Duplicate: How can one use multi threading in php applications Does anybody know
Possible Duplicate: How can one use multi threading in php applications Does PHP have
How can I use something like jQuery & PHP to reorder elements within an
How can one use Triggers for Logging History of database changes in MySQL? If
In *nix systems one can use which to find out the full path to
What is the highest port number one can use?
What are some useful Oracle optimizations one can use for an Application that mostly
On the MSVC++ compiler, one can use the __int8 , __int16 , __int32 and
On Google App Engine to query the data store with Python, one can use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.