Skip to content
Advertisement

How to make echo table with two div tag?

How to make echo for table with div ? Table do not work if I need to do echo.

My proposal with echo (not work):

<?php
    echo "<div class="container">
        <div class="main">
           <h2>User info</h2><hr/>
                <form id="form1" name="form1" method="post" action="input_form_02_qA_01.php">
                    <label>Name:<span>*</span></label><br />
                    <input type="text" name="nick" id="nick" placeholder="" required/>
                    <label>Email address:
                    <input type="text" name="email" id="email" placeholder="" required/>
                    </label>
                    <br/>
                    <label>Age:<span>*</span></label><br />
                    <input type="number" name="age" id="age" required/>
                    <label>Sex:<span>*</span></label><br />
                    <input type="radio" name="sex" value="man" required>Man
                    <input type="radio" name="sex" value="woman" required>Woman
                    <p>
                    <label>
                    <input type="submit" name="submit" id="Submit" value="Go to page 2" />
                    </label>
                </form>
        </div>
    </div>";
 ?>

Advertisement

Answer

Just change the echo ” to echo ‘ and at last “; to ‘; ?> Below code will work

<?php
echo '<div class="container">
    <div class="main">
       <h2>User info</h2><hr/>
            <form id="form1" name="form1" method="post" action="input_form_02_qA_01.php">
                <label>Name:<span>*</span></label><br />
                <input type="text" name="nick" id="nick" placeholder="" required/>
                <label>Email address:
                <input type="text" name="email" id="email" placeholder="" required/>
                </label>
                <br/>
                <label>Age:<span>*</span></label><br />
                <input type="number" name="age" id="age" required/>
                <label>Sex:<span>*</span></label><br />
                <input type="radio" name="sex" value="man" required>Man
                <input type="radio" name="sex" value="woman" required>Woman
                <p>
                <label>
                <input type="submit" name="submit" id="Submit" value="Go to page 2" />
                </label>
            </form>
    </div>
</div>';
?>
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement