Jump to content

send data from a new window to previous window in php


javadyousefi
 Share

Recommended Posts

I have an image in the main.php file :

  <img src="..\images\image.gif" class="cur" onclick="imgWin();">

when I click on this image below function has called :

function imgWin(){   imageWin=window.open("../pages/img.php","imageWin","toolbar=no,width=500,height=200,directories=no,menubar=no,SCROLLBARS=yes");}

this function opens img.php in a new windowimg.php file :

<HTML><HEAD>	<TITLE>upload image</TITLE></HEAD><BODY>	<FORM NAME="imgForm" method="get" action="#">		  address : 		  <INPUT type="file" name="imgUrl" size="50">		  description : 		  <INPUT type="text" name="description" size="50">		  <input type="submit" value="sumbit">	</form></BODY></HTML>

I want to when I click on submit button in above form , data from imgUrl and description textboxes send to main.php file.How to I can do it ?Please help me about this problem

Link to comment
Share on other sites

You could try setting the action parameter of your form tag to main.php, see if that does the trick?

Link to comment
Share on other sites

send data from a new window to previous window in php
I'm not entirely sure if this answers your question.The web uses a client-request model of communication. PHP can communicate with your first window only when the first window sends a request to your server. There is no way for PHP to send information to the first window in response to a request made by the second window.
Link to comment
Share on other sites

The form would need to be submitted and reloaded, and the HTML after the submission would need to send the commands to the parent window. I did something similar where I had a popup window for uploading files, and when the form was submitted successfully it just printed out a little bit of Javascript to run some functions on the parent window, and then close the popup.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...