Free Android CakePHP GMaps Articles by Bali Web Design

July 29, 2008

How to post form into a popup window

Filed under: html,javascript — Tags: , — admin @ 10:04 am

When you need to send a variable to a popup window from mainpage, ussually we will put it in url as GET method. But using this problem we will get problem when the variable has long character. We know that GET has limited long.

So we need to use POST method to submit a form. But how we can do it? I have a trick how to do it.

First we create a javascript for handling onsubmit event on html form.

function thePopupWindows(windowsname){
var win = window.open('', windowsname, ''width=580,height=450');
return true;
}

and then set this function on HTML Form :

<form action="popupwin.php" method="post" target="thepopup" onsubmit="return thePopupWindows(this.target);">
<input id="name" name="name" type="text" />
<input type="submit" value="Submit">
</form>


5 Comments »

  1. hi mario

    as i promise to you, i’ll visit your site :) bro

    by the way you have nice,clean blog i guess you will soon add more banner and “friends” on it hehe :)

    by the way can i ask you something about php and mysql things ? i have poor knowledge on this.

    could you make an article about how to write php, it’s about when we “click” the links but we link it to other php file
    example: http://www.iwany.com/goto/somewhere.php but the links goes to http://www.somewhere.com/page.html
    well thats it :) bro

    if you dont mind please add my link into your blog :) i’ll put your blog link into mine,

    thanks before
    iwany
    http://www.iwany.com

    Comment by iwany — August 29, 2008 @ 8:08 pm

  2. hi iwany,
    i appreciate with your suggestion, i have add friend link list.
    rather than create new article about it, i will try to help you here.

    in php file you can use
    <?php header(‘location: http://www.somewhere.com/page.html‘);?>

    but im not sure about your question, so if you were asking something else please feel free to contact me at admin@balistupa.com

    Comment by admin — September 1, 2008 @ 2:26 am

  3. As for me I do not like to complete forms on pop up window. It makes me mad. That’s why designing my sites, I try not ot use this method.

    Comment by Design Company Manager — November 4, 2008 @ 6:55 am

  4. for some case we need to send post variable into popup windows. you know that we have limit on get variable, so i think it is depend on situation. i believe we need this option also.

    Comment by admin — November 4, 2008 @ 7:00 pm

  5. #3 – sometimes you need to open some data by reading it from post variable, so for me this is usability thingie. Like – open window to print the page instead of opening in new tab or same window (which again makes mad me).

    Anyway, there is a typo with double quotes in before width=580[…]

    Comment by Edgars — May 12, 2011 @ 5:59 am

RSS feed for comments on this post. TrackBack URL

Leave a comment