Connecting Tech Pros Worldwide Forums | Help | Site Map

pop-up window

Newbie
 
Join Date: Mar 2009
Posts: 21
#1: Apr 6 '09
Hi,

Im just starting to learn PHP nor Java and I dont have any basic idea how to do this. But im asking of basic knowledge or script on how to do a pop-up window inside PHP and select the name inside the pop-up window to transfer on my main page. All I know is I have to use Java to make things work. To clarify, here the steps user will do.

1. open main page
2. cick the button contact name
3. a pop up window will appear with list box of contacts.
4. after selecting the contact people it will display the name back to main page.

I hope i made it clear. let me know if you need more information.

thanks!
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,936
#2: Apr 6 '09

re: pop-up window


PHP is server-side; it does not interact directly with the browser.

Ask in the javascript forum.

- mark.
Newbie
 
Join Date: Mar 2009
Posts: 21
#3: Apr 6 '09

re: pop-up window


thanks Mark for the input
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,642
#4: Apr 6 '09

re: pop-up window


a popup in Javascript is basicly like
Expand|Select|Wrap|Line Numbers
  1. window.open(file, name, settings);
Newbie
 
Join Date: Mar 2009
Posts: 21
#5: Apr 7 '09

re: pop-up window


Looks like after putting this thread on Java forum their kicking me out :) to PHP.

but anyways I was able to do the pop-up window the next problem Im having is how to copy the value selected from window 2 to window 1 back?

Expand|Select|Wrap|Line Numbers
  1. echo ' 
  2.     <h2>' . ( $id ? translate ( 'Edit Entry' ) : translate ( 'Add Entry' ) ) 
  3.  . $eType_label . '&nbsp;<img src="images/help.gif" alt="' . translate ( 'Help' ) 
  4.  . '" class="help" onclick="window.open( \'search_contact.php' 
  5.  . ( empty ( $id ) ? '?add=1' : '' ) 
  6.  . '\', \'cal_help\', \'dependent,menubar,scrollbars,height=400,width=800,' 
  7.  . 'innerHeight=420,outerWidth=420\' );" /></h2>' 
  8.  
  9.  
  10.  
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,936
#6: Apr 7 '09

re: pop-up window


Javascript, not Java. Two completely different things.

- mark.
Newbie
 
Join Date: Apr 2009
Posts: 9
#7: Apr 7 '09

re: pop-up window


Quote:

Originally Posted by mychikka View Post

Hi,

Im just starting to learn PHP nor Java and I dont have any basic idea how to do this. But im asking of basic knowledge or script on how to do a pop-up window inside PHP and select the name inside the pop-up window to transfer on my main page. All I know is I have to use Java to make things work. To clarify, here the steps user will do.

1. open main page
2. cick the button contact name
3. a pop up window will appear with list box of contacts.
4. after selecting the contact people it will display the name back to main page.

I hope i made it clear. let me know if you need more information.

thanks!

Thanks that works for me.
Newbie
 
Join Date: Apr 2009
Posts: 9
#8: Apr 7 '09

re: pop-up window


hi i want to know more and more regarding this.
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,642
#9: Apr 7 '09

re: pop-up window


Quote:

Originally Posted by vrsoft View Post

hi i want to know more and more regarding this.

about this (the topic) or this (the JavaScript keyword)?
Newbie
 
Join Date: Apr 2009
Posts: 9
#10: Apr 7 '09

re: pop-up window


i want to learn php sample projects
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,642
#11: Apr 7 '09

re: pop-up window


if you have something specific in mind open a new thread and ask it. if it's some general, you may find some articles in the insights section useful or (even more general) look for a tutorial.

the PHP Manual Pages also offer lots of useful information.
Newbie
 
Join Date: Apr 2009
Posts: 9
#12: Apr 7 '09

re: pop-up window


Quote:

Originally Posted by Dormilich

Thank you.

Thanks.actually i am new to this forums.so i don't know how to use it.
if u don't mind will u give details about this?
how to lock my thread not to be replied by others.
how will i be informed if i've got a reply 4 my post.
i wonder how u monitor our posts and replies,kindly tell me.
Member
 
Join Date: Jun 2008
Posts: 97
#13: Apr 7 '09

re: pop-up window


you can do this in javascript just like this in popup window

Expand|Select|Wrap|Line Numbers
  1. window.opener.document.getElementById( 'xyz' ).value = value_from_contactbox 
  2. window.close();
  3.  
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,642
#14: Apr 7 '09

re: pop-up window


Quote:

Originally Posted by vrsoft View Post

Thanks.actually i am new to this forums.so i don't know how to use it. if u don't mind will u give details about this?

general advice you can find in the help section and the posting guidelines

Quote:

Originally Posted by vrsoft View Post

how to lock my thread not to be replied by others.

this can be done by moderators, although it's not practiced.
Quote:

Originally Posted by vrsoft View Post

how will i be informed if i've got a reply 4 my post.
i wonder how u monitor our posts and replies,kindly tell me.

you can change these notification settings in the user control panel. make sure to regularly check your PMs

kind regards and welcome at Bytes
Newbie
 
Join Date: Apr 2009
Posts: 9
#15: Apr 7 '09

re: pop-up window


may i know how you moderators monitor our posts and replies,kindly tell me.
are u having mail alert or database checking or are u having any technical user interface tool?
bcaz as soon as i posted here u would reply.so how?
Newbie
 
Join Date: Mar 2009
Posts: 21
#16: Apr 8 '09

re: pop-up window


Here's what I got after encorporating waqasahmed996 code but it doesn't do anything. By the way I put this script on the pop-up window or second window. Please let me know what im missing.

thanks!

Expand|Select|Wrap|Line Numbers
  1. echo "<input type='button' value='Select' onclick=window.opener.document.getElementById( 'ContactID' ).value = value_from_contactbox  window.close()'>"; 
  2.  
Member
 
Join Date: Jun 2008
Posts: 97
#17: Apr 9 '09

re: pop-up window


you will write this code in new window. and you can write this code in java script tag. You just have to call that function according to your requirement.
Expand|Select|Wrap|Line Numbers
  1. <script language="javascript">
  2. function fname(value_of_listbox)
  3. {
  4. window.opener.document.getElementById( 'medicinename' ).value = value_of_listbox
  5. window.close();
  6. }
  7. </script>
  8.  
Newbie
 
Join Date: Apr 2009
Posts: 9
#18: Apr 9 '09

re: pop-up window


Why am i alone not given any answer?
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,642
#19: Apr 9 '09

re: pop-up window


check out this post.
Newbie
 
Join Date: Mar 2009
Posts: 21
#20: Apr 9 '09

re: pop-up window


Thanks waqasahmed996 this what I did on my pop-up window and still does'nt work I hope Im almost there :) smile.

Java Script on top of body tag
Expand|Select|Wrap|Line Numbers
  1. <script language="javascript"> 
  2. function contactID(ContactID) 
  3. window.opener.document.getElementById( 'ContactID' ).value = ContactID 
  4. window.close(); 
  5. </script> 

inside PHP
Expand|Select|Wrap|Line Numbers
  1. echo "<input type='button' value='". $row['contactid']. "' 
  2. onclick='ContactID(ContactID)'>";  

result:
Page Error
Member
 
Join Date: Jun 2008
Posts: 97
#21: Apr 10 '09

re: pop-up window


error may be due to this reason that you are using Capital letter 'C' in php and small in java script 'c' while calling function ContactID

try like this

Expand|Select|Wrap|Line Numbers
  1. echo "<input type='button' value='$abc' 
  2.  onclick='contactID($abc)'>"; 
  3.  
Newbie
 
Join Date: Mar 2009
Posts: 21
#22: Apr 10 '09

re: pop-up window


Quote:

Originally Posted by waqasahmed996 View Post

error may be due to this reason that you are using Capital letter 'C' in php and small in java script 'c' while calling function ContactID

try like this

Expand|Select|Wrap|Line Numbers
  1. echo "<input type='button' value='$abc' 
  2.  onclick='contactID($abc)'>"; 
  3.  

How can I set a value for a parameter to pass if its a result of a query.
eg. ". $row['contactid']. "
Member
 
Join Date: Jun 2008
Posts: 97
#23: Apr 13 '09

re: pop-up window


you can write like this

Expand|Select|Wrap|Line Numbers
  1. echo "<input type='button' value='".$row['contactid']."' onclick='contactID($row[contactid])'>"; 
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,642
#24: Apr 13 '09

re: pop-up window


some minor optimization (PHP)
Expand|Select|Wrap|Line Numbers
  1. echo "<input type='button' value='", $row['contactid'], "' onclick='contactID($row[contactid])'>"; 
Reply

Tags
asp.net, c++