Jump to content

Form with preview box


esoteric

Recommended Posts

Hi, im trying to figure out how to have a form preview something next to the form depending on what options have been selected on a form. So let me explain better what i mean.

 

I want to create a form which is for customers to create a custom product (in this case a nameplate).

 

The options could be something like;

letters (what word they want)

font type: [few different font names here]

font size: [small, medium, large]

color: ...

 

So if the customer typed in 'name' in the letters field then it would be displayed in the preview box

 

If the customer then selected a font type, the change would then be reflected in the preview box.. and so on.

 

I hope you understand what i trying to explain. I can just about handle creating the form but i don't know how to have it display what options have been chosen. If this is too much effort would it just be easier to submit this form and then display the data? or is it not too complicated to have it display on the same form before you submit it?

 

I would prefer it displayed on the same page

 

Thanks for any help.

 

 

 

 

 

Link to comment
Share on other sites

This is going to be a combination of JavaScript and PHP

 

I would do this in the following manner.

 

Have an outside PHP file use values in the query string (using $_GET) to generate a preview image you want to display (using imagemagick or GD)

Have a JavaScript application in your form page that checks for certain fields in your form to be updated.

When the form is updated, the JavaScript will update an img tag beside the form and the outside PHP file will generate the new image.

 

Watch out though. A PHP script that generates images on the fly can be abused to slow down your server. You may want to limit how many requests any given IP can make in 10 minutes or some reasonable time. If you notice the same options being used again and again, setting up a caching script may be useful as well.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.