theo 0 Posted July 19, 2011 Report 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>'; ?> Quote Link to post Share on other sites
Paul Swanson 104 Posted July 19, 2011 Report 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>'; ?> Quote Link to post Share on other sites
theo 0 Posted July 20, 2011 Author Report Share Posted July 20, 2011 thank you sir.. Quote Link to post Share on other sites
Antonio Conte 426 Posted July 20, 2011 Report 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. Quote Link to post Share on other sites
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.
Note: Your post will require moderator approval before it will be visible.