samona Posted June 10, 2008 Share Posted June 10, 2008 How can I create a preview button similar to the one in the forums. This way a user can preview a form and make sure everything is correct before submitting it into the database. Link to comment https://forums.phpfreaks.com/topic/109606-solved-preview-button/ Share on other sites More sharing options...
asmith Posted June 10, 2008 Share Posted June 10, 2008 <?php if (isset($_POST[preview])) // if preview button is clicked will do this. { echo "you entered : $_POST[username] <br /> Are you sure ? "; echo "<form action="file_itself" action="post"> <input type="hidden" name="entered_username" value="$_POST[username]" /> // store the username value in a hidden input <input type="submit" name="submit" value="submit" /></form>"; } else if (isset($_POST[submit])) // if submit button , which is in the preview page is clicked will do this. { // record to the database } else // if no button is clicked, so they need to see the main form { echo ' <form action="file_itself" method="post" > name : <input type="text" name="username" /> <input type="submit" name="preview" value="preview" /> </form>'; } ?> Link to comment https://forums.phpfreaks.com/topic/109606-solved-preview-button/#findComment-562238 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.