5
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by Ankit_Parmar
0

Your question is vague and might be interpreted in different ways depending on how much importance that you put on 'properly'. You can easily mix php and html in a PHP module. Just end the PHP section with a ?> and start your html. You can go back and forth as many times as needed in a module. You can also use PHP to echo html statements. The purists don't like to see things mixed together so they would probably prefer the first approach. You can also put your html in separate modules and include them at the appropriate place(e) in your PHP module.

0
<?php
echo "<form>
<input type='text' name='txtsample' value='' />
<input type='submit' name='btnsubmit' value='submit' />
</form>";
?>

or

<form>
<input type='text' name='txtsample' value="<?=$_GET['txtsample']?>" />
<input type='submit' name='btnsubmit' value='submit' />
</form>"
0

Below is the sample of mixing html and php:

<html>
<head></head>
<body>

<?php
if (!isset($_POST['submit'])) {
?>

    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    Enter your age: <input name="age" size="2">
    <input type="submit" name="submit" value="Go">
    </form>

<?php
    }
else {
echo "Else part";
}
?>

</body>
</html>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.