943,682 Members | Top Members by Rank

Ad:
Jan 6th, 2004
0

Showing results of a form in new window

Expand Post »
Evening all, first post so be nice

I want to know if it is possible to show the results of a form in a new window. So when you press the submit button on a post or get type of form, how do you get it to show the results in a new page?

I can post code if you want to but i think there is enough to go on.

Thanks and look forward to helping out too...

IK
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
IbnKuldun is offline Offline
10 posts
since Jan 2004
Jan 6th, 2004
0

Re: Showing results of a form in new window

Can be done in php, when yuo name the form's field, then you can export that as a $name variable.
Reputation Points: 12
Solved Threads: 3
Posting Whiz in Training
rixius is offline Offline
212 posts
since Nov 2003
Jan 7th, 2004
0

Re: Showing results of a form in new window

Welcome to TTF!

The easiest way is to submit the form to target="_blank" - here's some sample code in HTML/PHP. The PHP code is just so the form doesn't get displayed:

[PHP]<?
if(isset($_POST['something'])) {
echo $_POST['something'];
}
else {
echo '
<form action="'.$_POST['SCRIPT_NAME'].'" method="post" target="_blank" >
Input Something: <input type="text" name="something">
<input type="submit" value="Submit">
</form>';
}
?> [/PHP]

Any questions, just ask.
Team Colleague
Reputation Points: 262
Solved Threads: 18
a.k.a inscissor
samaru is offline Offline
1,227 posts
since Feb 2002
Jan 7th, 2004
0

Re: Showing results of a form in new window

Thanks for the welcome guys and a successful one at that.

I didnt realise you could use the target variable in the form tag.

Thanks!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
IbnKuldun is offline Offline
10 posts
since Jan 2004
Jan 9th, 2004
0

Re: Showing results of a form in new window

Quote originally posted by rixius ...
Can be done in php, when yuo name the form's field, then you can export that as a $name variable.
Hmm? What do you mean? What's the other way to do it? I can't think of any right this minute, so maybe you can clear it up.
Team Colleague
Reputation Points: 262
Solved Threads: 18
a.k.a inscissor
samaru is offline Offline
1,227 posts
since Feb 2002
Jan 10th, 2004
0

Re: Showing results of a form in new window

HTML and CSS Syntax (Toggle Plain Text)
  1. <form action=page.php method=post>
  2. <input type=text name=var>
  3. <input type=text name=var2>
  4. </form>

You could export the content of that form as $var and $var2.
Reputation Points: 12
Solved Threads: 3
Posting Whiz in Training
rixius is offline Offline
212 posts
since Nov 2003
Jan 11th, 2004
0

Re: Showing results of a form in new window

How does that open up a new window and display the variables submitted? Sorry, not trying to be a dick about it, just not following.
Team Colleague
Reputation Points: 262
Solved Threads: 18
a.k.a inscissor
samaru is offline Offline
1,227 posts
since Feb 2002
May 26th, 2004
0

Re: Showing results of a form in new window

Greetings.
How about using Javascript alone?
Is it possible to show the results of a form in a new window?
I have seen how things were done using Request.QueryString by decoding the url. But is there other alternative similar to the ASP's Request.Form("element") way? I'm trying to avoid using ASP, because the server doesn't have IIS. Please help.
Reputation Points: 53
Solved Threads: 1
Posting Whiz
red_evolve is offline Offline
313 posts
since Jun 2003
Jul 18th, 2010
0
Re: Showing results of a form in new window
php Syntax (Toggle Plain Text)
  1. <?php if(isset($_POST['field1')){
  2. if(isset($_POST['field2'])) {
  3. /* validate field values
  4.  if values acceptible
  5.  connect to database
  6.  update database
  7.  set disabled flag ($disabled = true ) to prevent resubmission */ } } ?>
  8. <form action='<?php echo $_server['PHP_SELF']; ?>' method='post'>
  9. <input type='text' name='field1' value='<?php if(isset($_POST['field1'] {echo $_POST['field1'];} ?>' /><br />
  10. <input type='text' name='field2' value='<?php if(isset($_POST['field2'] {echo $_POST['field2'];} ?>' /><br />
  11. <input type='submit' value='whoopdiedoo' <?php if(isset($disabled) {echo 'disabled="disabled"';} ?>/></form>
incomplete code scrap
Form submits to itself displays the values submitted in the form (very messy code but its ONLY a sample of what can be done)
Last edited by almostbob; Jul 18th, 2010 at 4:21 pm.
Reputation Points: 562
Solved Threads: 368
Posting Maven
almostbob is offline Offline
2,970 posts
since Jan 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: CSS fixed footer
Next Thread in HTML and CSS Forum Timeline: How can I display a div on button click?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC