By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,504 Members | 1,092 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,504 IT Pros & Developers. It's quick & easy.

pop-up window

P: 21
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!
Apr 6 '09 #1
Share this Question
Share on Google+
23 Replies


Markus
Expert 5K+
P: 6,050
PHP is server-side; it does not interact directly with the browser.

Ask in the javascript forum.

- mark.
Apr 6 '09 #2

P: 21
thanks Mark for the input
Apr 6 '09 #3

Dormilich
Expert Mod 5K+
P: 8,639
a popup in Javascript is basicly like
Expand|Select|Wrap|Line Numbers
  1. window.open(file, name, settings);
Apr 6 '09 #4

P: 21
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.  
Apr 6 '09 #5

Markus
Expert 5K+
P: 6,050
Javascript, not Java. Two completely different things.

- mark.
Apr 6 '09 #6

P: 9
@mychikka
Thanks that works for me.
Apr 7 '09 #7

P: 9
hi i want to know more and more regarding this.
Apr 7 '09 #8

Dormilich
Expert Mod 5K+
P: 8,639
@vrsoft
about this (the topic) or this (the JavaScript keyword)?
Apr 7 '09 #9

P: 9
i want to learn php sample projects
Apr 7 '09 #10

Dormilich
Expert Mod 5K+
P: 8,639
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.
Apr 7 '09 #11

P: 9
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.
Apr 7 '09 #12

100+
P: 160
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.  
Apr 7 '09 #13

Dormilich
Expert Mod 5K+
P: 8,639
@vrsoft
general advice you can find in the help section and the posting guidelines

@vrsoft
this can be done by moderators, although it's not practiced.
@vrsoft
you can change these notification settings in the user control panel. make sure to regularly check your PMs

kind regards and welcome at Bytes
Apr 7 '09 #14

P: 9
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?
Apr 7 '09 #15

P: 21
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.  
Apr 8 '09 #16

100+
P: 160
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.  
Apr 9 '09 #17

P: 9
Why am i alone not given any answer?
Apr 9 '09 #18

Dormilich
Expert Mod 5K+
P: 8,639
check out this post.
Apr 9 '09 #19

P: 21
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
Apr 9 '09 #20

100+
P: 160
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.  
Apr 10 '09 #21

P: 21
@waqasahmed996
How can I set a value for a parameter to pass if its a result of a query.
eg. ". $row['contactid']. "
Apr 10 '09 #22

100+
P: 160
you can write like this

Expand|Select|Wrap|Line Numbers
  1. echo "<input type='button' value='".$row['contactid']."' onclick='contactID($row[contactid])'>"; 
Apr 13 '09 #23

Dormilich
Expert Mod 5K+
P: 8,639
some minor optimization (PHP)
Expand|Select|Wrap|Line Numbers
  1. echo "<input type='button' value='", $row['contactid'], "' onclick='contactID($row[contactid])'>"; 
Apr 13 '09 #24

Post your reply

Sign in to post your reply or Sign up for a free account.