Jump to content

How do I submit my form, in a new window?


Xanco

Recommended Posts

Hello peoples.

Right, what I'm trying to do is; you fill out a form that generates a HTML page (done with no problems) but you want to preview it before. So essentially, what I'm trying to do it submit a form, but opening another window in doing so, meaning that the entered information on the 1st page stays the same. Here's the code I'm trying:

 

 

<form action="store_it.php" method="post" id="contact">
<fieldset>
<label for="name" >The title of your page:*</label>
<input type="text" name="name" value="<?php echo $name; ?>" placeholder="My project" id="name">
<br><label for="body" title="You may use HTML code in this box">The text for your page:*</label>
<textarea onfocus="window.lstText=this;" name="body" value="<?php echo $body; ?>" id="body"></textarea><br>
<input type="submit" value="Submit" name="submit" class="button" id="submit"><br>
<input type="submit" value="Preview" onclick="window.open('store_it.php')"><br>
</fieldset>
</form>
 

 - Thanks, Xanco

Edited by Xanco
Link to comment
Share on other sites

im not sure what you are asking.  but, i think this is not an HTML question so you might get better help elswhere.  javascript is likely what you are after.  i see that you are using that for your submission.  if your concern is keeping data in their respective fields, you could use php sessions to store values and, isset(), assign them to each field.

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...

I don't see the point of using a 2nd window to show the input while it's still on the old window.  If your concern is not losing the input data after you have processed it (in case of an input error), your php code can very easily just return the original screen with the input and any needed error messages displayed.

 

Personally - I would find an application to be a bit klutzy if I had to look at an intermediate screen in order to use it.  Plus - popup windows like yours are generally frowned upon.

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.