View Full Version : HTML form - 2 submit buttons going to different places?

01-18-2004, 02:54 AM
I've built a site for a client and there is a page which lists news stories. This is to be updated by them and I've been building a small admin area using php for this purpose.

So I've created a form for adding a News Story to the site and has input fields for the story text and a file input box to upload an image.

There is an "Add" (submit) button which submits the form, adds the story text to the database and stores the uploaded image in a folder (using the inserted id of that that record as the image name).

Once the add button is clicked though, the story is up live on the site. I thought it would be good if the client could get a preview first of what the page would look like so on my form page I'd like to have a "preview"(submit) button which submits to a different preview page.

This preview page would just display the inputted info and add the image to a temp directory.

This is not ideal but seems to be the simplest way i can think of so far.

so.... is it possible to have 2 submit buttons in a form both going to different places.

Also if you have any better suggestions on a way to give the client a preview of the content they have added before it's actually live please let me know.

01-18-2004, 06:21 PM
<form action="">
all the form fields here

<input type="button" value="Preview"

<input type="button" value="Submit"

10-05-2009, 05:29 PM
Thanks this helped me today

10-05-2009, 06:40 PM
so.... is it possible to have 2 submit buttons in a form both going to different places.
I'd use a single page and add conditional blocks to execute the code based on which button was pressed(without any javascript code, which is not reliable in all cases).