Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Aug 2002
    Thanked 0 Times in 0 Posts

    HTML form - 2 submit buttons going to different places?

    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.

  • #2
    Regular Coder COBOLdinosaur's Avatar
    Join Date
    Jul 2002
    Thanked 32 Times in 32 Posts
    <form action="">
    all the form fields here

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

    <input type="button" value="Submit"
    100% standards compliant code is 100% correct 100% of the time.
    one of my toys from my repository and perhaps some help getting help


  • #3
    New Coder
    Join Date
    Oct 2009
    Thanked 0 Times in 0 Posts
    Thanks this helped me today

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Thanked 2,224 Times in 2,211 Posts
    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).
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts