preview and submit

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

preview and submit

Post by s.dot »

I'm making a 'CSS generator'

I have it all done, clicking on the 'Generate Code' button, loads the code into an iframe. Awesome!

But before they generate their code, I'd like them to be able to press a 'Preview' button, which will open a small popup window that shows them the effect of their CSS code, so they can change their settings if they like.

I don't know how to send the $_POST data from the form to this preview page, and still have the Submit (generate code) button there.

Would this require two forms?
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
AndrewBacca
Forum Commoner
Posts: 62
Joined: Thu Jan 30, 2003 10:03 am
Location: Isle of Wight, UK

Post by AndrewBacca »

you could set the submit button to say "preview"
send the action setting to the preview.php
and have the code for previewing it on that page and then have another hidden form with the settings from the form before in and another submit button which goes to a save page

Just an idea but that is what I do when I am checking data sent from forms so it should work :)
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

well i wouldn't like to redirect to a preview page, it'd just like to have it open in a popup.

I could do the if($action=="preview") thing..

but I would either have to send the post data to the $action="preview" or $action="generate"

how does this forum do the preview thing before you submit the data?
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
AndrewBacca
Forum Commoner
Posts: 62
Joined: Thu Jan 30, 2003 10:03 am
Location: Isle of Wight, UK

Post by AndrewBacca »

If I'm not misstaken its simliar to what I descriped but I may be wrong!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Preview on most forums is done via submission to the server so it can process the data correctly to give you accurate data back.

If you want to use a popup like device, I'd suggest using a floating div and XMLHTTP transport, as that will play nicely with popup blockers, since it isn't one, and probably feel pretty neat from a user experience perspective.
Post Reply