aggrav8d Posted September 21, 2009 Share Posted September 21, 2009 Say you have a store that sells cars. You want to be able to add, remove, and edit cars. The tricky part I can't figure out is an easy way to preview changes to a car before you hit save. Opening a new window is not a problem. Posting to the new window is also not a problem. Making the system understand that I want it to show the temporary version of the Car and not the last saved version is my problem. How would you do this? On a related topic, when a user starts to create a new instance of something do you save it immediately to the database and delete it again if they hit cancel OR do you wait for them to hit SAVE before you write to the database? I can see advantages to both methods. Quote Link to comment Share on other sites More sharing options...
mikesta707 Posted September 21, 2009 Share Posted September 21, 2009 To make a preview of something, all you need to do is pass the post variables to the preview page, and output them. You also want to store those variables in hidden forms, and when the user wants to save the changes, hit submit, else, bring them back to the previous page, and repopulate the data. for example preview.php <?php $post = $_POST['my_var'];//post variable to preview echo "The value: $post"; ?> <form name="form" action="submit.php" method="post"> <input type="hidden" name="my_var" value="<?php echo $post; ?>" /> <input type="submit" value="submit" /> and submit.php would be the page that you process the form, and all that stuff Quote Link to comment Share on other sites More sharing options...
aggrav8d Posted September 21, 2009 Author Share Posted September 21, 2009 I wasn't really clear in my initial post, there's a lot of intricacies to my situation that I didn't spell out. I'm marking this solved anyways because I think I need to go back and redesign. Thanks. Quote Link to comment Share on other sites More sharing options...
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.