theo Posted July 19, 2011 Share Posted July 19, 2011 having problem with sticky forms inside php: inside html tags: <form action="" method="post"> <p>Lastname:<input type="text" name="last_name" size="20" maxlength="20" value="<?php if (isset($_POST['last_name'])) echo $_POST['last_name']; ?>" /></p> </form> inside php: ---> what is the correct syntax <?php echo '<form action="" method="post"> <p>Lastname:<input type="text" name="last_name" size="20" maxlength="20" value="php code here???" /></p>'; ?> Link to comment Share on other sites More sharing options...
Paul Swanson Posted July 19, 2011 Share Posted July 19, 2011 You'll have to use concatenation to use PHP functions within a string echoed by PHP: <?php echo '<form action="" method="post"> <p>Lastname:<input type="text" name="last_name" size="20" maxlength="20" value="' . (isset ($_POST['last_name']) ? $_POST['last_name'] : '') . '" /></p>'; ?> Link to comment Share on other sites More sharing options...
theo Posted July 20, 2011 Author Share Posted July 20, 2011 thank you sir.. Link to comment Share on other sites More sharing options...
Antonio Conte Posted July 20, 2011 Share Posted July 20, 2011 Download an IDE like Netbeans or Eclipse. They're both free and will help you with syntax errors like these. Link to comment Share on other sites More sharing options...
Recommended Posts