473,386 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

form-pop up

In php, is there any way to submit button(in a form) makes window
pop-up?

-INDEX.PHP :

<form id="form1" name="form1" method="post" action="vehicle.php">
<input name="submit" type="submit" id="submit" value="submit" />
</form>

This goes to only action page. (vehicle.php)
I wanna pop-up the page(vehicle.php) and use data from index page.
Also when i close the pop up page, I wanna use data in index what was
selected in pop-up page(vehicle.php)

Is it possible? Thx!

Oct 11 '06 #1
3 7989
kirke wrote:
In php, is there any way to submit button(in a form) makes window
pop-up?

-INDEX.PHP :

<form id="form1" name="form1" method="post" action="vehicle.php">
<input name="submit" type="submit" id="submit" value="submit" />
</form>

This goes to only action page. (vehicle.php)
I wanna pop-up the page(vehicle.php) and use data from index page.
Also when i close the pop up page, I wanna use data in index what was
selected in pop-up page(vehicle.php)

Is it possible? Thx!
Hi,

This has little to do with PHP. It is just a HTML thing.
Just add a target to your form and it will pop-up in a new window.
(If you need to address that window from javascript, use the name you just
gave it in your form.)

<form action="vehicle.php" method="POST" target="myNewWindow">
Regards,
Erwin Moller
Oct 11 '06 #2
wow! thx! that's exactly what i want!

can i do one more question?

Thus, i can pop-up the window.
and there's also drop-down box. and we need submit button.
However, when i click the submit button (in pop-up window), i want to
close it and its action page is index.php(previous page)
which commend is needed to do this?
Thx! again!

Erwin Moller wrote:
kirke wrote:
In php, is there any way to submit button(in a form) makes window
pop-up?

-INDEX.PHP :

<form id="form1" name="form1" method="post" action="vehicle.php">
<input name="submit" type="submit" id="submit" value="submit" />
</form>

This goes to only action page. (vehicle.php)
I wanna pop-up the page(vehicle.php) and use data from index page.
Also when i close the pop up page, I wanna use data in index what was
selected in pop-up page(vehicle.php)

Is it possible? Thx!

Hi,

This has little to do with PHP. It is just a HTML thing.
Just add a target to your form and it will pop-up in a new window.
(If you need to address that window from javascript, use the name you just
gave it in your form.)

<form action="vehicle.php" method="POST" target="myNewWindow">
Regards,
Erwin Moller
Oct 11 '06 #3
kirke wrote:
wow! thx! that's exactly what i want!
good. :-)
Glad to be of help.
can i do one more question?
sure.
>
Thus, i can pop-up the window.
and there's also drop-down box. and we need submit button.
However, when i click the submit button (in pop-up window), i want to
close it and its action page is index.php(previous page)
which commend is needed to do this?
Thx! again!
The easiest way to do this is by making the target of the form in the popup
a new script that:
1) processes your posting. (DB-update or something)
So you do NOT let your original page do the processing.
2) will only output this:

<?
// process your posting of the dropdown

?>
<html>
<head>
<script type="text/javascript">
// optionally refresh the original page
opener.location.reload(true);

// close this popupwindow
self.close();
</script>
</head>
</html>
But this might get you into trouble because javascript is now closing a
window that is NOT created by JavaScript.
Some browsers will ask the user for permission to close the window, which is
an annoyance in your case. Test it.

You can solve this by letting Javascript open the popup in the first place.
If JavaScript opened the page, the browser will let JavaScript close it
without a warning.

This has little to do with PHP, but I'll give you an example. If you need
more, just go to the right place: comp.lang.javascript

How to let Javascript open a new window?

1) Replace your submitbutton with something like this:
<input type="button" value="makepopup" onClick="doPopup();">

and add a function somewhere on your first page:
<script type="text/javascript">
funtion doPopup(){
// make a new window with the name MyNewWindow
var myPopup = window.open("blank.html","MyNewWindow");

// Post the form
document.forms["yourformnamehere"].submit();

}
</script>

You'll have to provide an empty page named blank.html.
Also name your form by adding name="bla", and use that name in the
documnt.forms["bla"].submit();

Warning1: I didn't test this, but the idea works.
Warning2: This will completely fail if the visitor has no Javascript
enabled.
If this is the case, then you cannot close a popup window, no matter what.

Regards,
Erwin Moller

Oct 11 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: John | last post by:
Dear all, It been more than 3 days I am trying to debug this program, I interpret it using activePerl and it is giving (perl -wc code_process.pl) no error syntax but when I put it online, change...
5
by: Richard Cornford | last post by:
I am interested in hearing opinions on the semantic meaning of FORM (elements) in HTML. I have to start of apologising because this question arose in a context that is not applicable to the...
4
by: Targa | last post by:
Trying to total some price fields in a form but doesnt work when all the referenced form fields dont exisit. This is for an invoice - pulled prom a database and the form doesnt always contain the...
19
by: Raposa Velha | last post by:
Hello to all! Does any of you want to comment the approach I implement for instantiating a form? A description and an example follow. Cheers, RV jmclopesAThotmail.com replace the AT with the...
5
by: RAJ | last post by:
hi plz tell me how to know "how window is going to close"... i have to right code for X button of forms... plz telll me thanks bye
3
by: Bill | last post by:
I'm using the POST method to submit a simple form html page with yes/no and checkbox fields to an asp response page which stores the values in a new dim string, then uses it to build a new table...
5
by: Miro | last post by:
I will try my best to ask this question correctly. I think in the end the code will make more sence of what I am trying to accomplish. I am just not sure of what to search for on the net. I...
8
by: hoofbeats95 | last post by:
I don't think this should be this complicated, but I can't figure it out. I've worked with C# for several years now, but in a web environment, not with windows form. I have a form with a query...
5
by: simononestop | last post by:
Hi im totally new to perl this is my first go at using it (I normally use asp). I have set up a form with a cgi script from demon hosting. I have edited the script and the form works it sends me an...
6
by: Thom Little | last post by:
Using C# 3.5 I have a form that calls many other sub-forms. Typically there will be five forms open at the same time. If the main form is closed all the sub forms are also closed. Is there...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.