pop-up window | Newbie | | Join Date: Mar 2009
Posts: 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!
|  | Moderator | | Join Date: Jun 2007 Location: York, England, with wolves.
Posts: 4,936
| | | 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
| | | re: pop-up window
thanks Mark for the input
|  | Moderator | | Join Date: Aug 2008 Location: Leipzig, Germany
Posts: 3,642
| | | re: pop-up window
a popup in Javascript is basicly like - window.open(file, name, settings);
| | Newbie | | Join Date: Mar 2009
Posts: 21
| | | 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? -
echo '
-
<h2>' . ( $id ? translate ( 'Edit Entry' ) : translate ( 'Add Entry' ) )
-
. $eType_label . ' <img src="images/help.gif" alt="' . translate ( 'Help' )
-
. '" class="help" onclick="window.open( \'search_contact.php'
-
. ( empty ( $id ) ? '?add=1' : '' )
-
. '\', \'cal_help\', \'dependent,menubar,scrollbars,height=400,width=800,'
-
. 'innerHeight=420,outerWidth=420\' );" /></h2>'
-
-
-
|  | Moderator | | Join Date: Jun 2007 Location: York, England, with wolves.
Posts: 4,936
| | | re: pop-up window Javascript, not Java. Two completely different things.
- mark.
| | Newbie | | Join Date: Apr 2009
Posts: 9
| | | re: pop-up window Quote:
Originally Posted by mychikka 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
| | | re: pop-up window
hi i want to know more and more regarding this.
|  | Moderator | | Join Date: Aug 2008 Location: Leipzig, Germany
Posts: 3,642
| | | re: pop-up window Quote:
Originally Posted by vrsoft 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
| | | re: pop-up window
i want to learn php sample projects
|  | Moderator | | Join Date: Aug 2008 Location: Leipzig, Germany
Posts: 3,642
| | | 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
| | | 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
| | | re: pop-up window
you can do this in javascript just like this in popup window -
window.opener.document.getElementById( 'xyz' ).value = value_from_contactbox
-
window.close();
-
|  | Moderator | | Join Date: Aug 2008 Location: Leipzig, Germany
Posts: 3,642
| | | re: pop-up window Quote:
Originally Posted by vrsoft 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 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 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
| | | 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
| | | 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! -
echo "<input type='button' value='Select' onclick=window.opener.document.getElementById( 'ContactID' ).value = value_from_contactbox window.close()'>";
-
| | Member | | Join Date: Jun 2008
Posts: 97
| | | 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. -
<script language="javascript">
-
function fname(value_of_listbox)
-
{
-
window.opener.document.getElementById( 'medicinename' ).value = value_of_listbox
-
window.close();
-
}
-
</script>
-
| | Newbie | | Join Date: Apr 2009
Posts: 9
| | | re: pop-up window
Why am i alone not given any answer?
|  | Moderator | | Join Date: Aug 2008 Location: Leipzig, Germany
Posts: 3,642
| | | re: pop-up window | | Newbie | | Join Date: Mar 2009
Posts: 21
| | | 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 - <script language="javascript">
-
function contactID(ContactID)
-
{
-
window.opener.document.getElementById( 'ContactID' ).value = ContactID
-
window.close();
-
}
-
</script>
inside PHP - echo "<input type='button' value='". $row['contactid']. "'
-
onclick='ContactID(ContactID)'>";
result:
Page Error
| | Member | | Join Date: Jun 2008
Posts: 97
| | | 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 -
echo "<input type='button' value='$abc'
-
onclick='contactID($abc)'>";
-
| | Newbie | | Join Date: Mar 2009
Posts: 21
| | | re: pop-up window Quote:
Originally Posted by waqasahmed996 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 -
echo "<input type='button' value='$abc'
-
onclick='contactID($abc)'>";
-
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
| | | re: pop-up window
you can write like this - echo "<input type='button' value='".$row['contactid']."' onclick='contactID($row[contactid])'>";
|  | Moderator | | Join Date: Aug 2008 Location: Leipzig, Germany
Posts: 3,642
| | | re: pop-up window
some minor optimization (PHP) - echo "<input type='button' value='", $row['contactid'], "' onclick='contactID($row[contactid])'>";
|  | Similar JavaScript / Ajax / DHTML bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,387 network members.
|