Forum Moderators: coopster

Message Too Old, No Replies

address book

         

ghoti

1:23 am on Apr 23, 2003 (gmt 0)

10+ Year Member



Hi

My name is ghoti, and i am new here. First off, i want to say that this is a great place, and thank you to the webmaster who set this place up.

As for my question...

I am new to php, but i am learning fast, as i do with any new programming language that i learn.

I am setting up a script that has an email option in the admin area. I want it set up so the admin of the site can send emails to their members easily.

I have the email script all set up, and it's running nicely, with everything i need. I just wanted one little thing added.

I want to be able to have a link where email addresses of members are displayed in a different screen, and each one given a check box. When the user checks on the boxes, then hits submit, i want the email addresses transfered to the form on the original email page.

Get what i mean?

Basically what i am asking for is an address book thing, like what hotmail, or many other email service providers have, that fills in the 'to' area of the email form, with that page opened.

In other words, how do you pass values into the text areas, or input areas, of a form, when that form is still open, without reloading the page?

Any help with this would be great.

Thank you

willybfriendly

4:45 am on Apr 23, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think that what you are talking about would require a client side solution. Something with JS would probably work, but that is not my forte, so I can not offer a solid suggestion for you.

"In other words, how do you pass values into the text areas, or input areas, of a form, when that form is still open, without reloading the page? "

Using a server side approach (like PHP) will require that the page be reloaded.

WBF

dmorison

5:08 am on Apr 23, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Ghoti,

WBF is right - it sounds like you'd be better off with a client side JavaScript solution.

In JavaScript, self.opener can be used to modify form elements on the parent window.

The following two snippets give a basic example:

**************
* test1.html
**************

<html>

<body>

<script type='text/javascript'>

window.open('test2.html');

</script>

<form name='foo'>

<input type='text' name='to'>

</form>

</body>

</html>

**************
* test2.html
**************

<html>

<body>

<script type='text/javascript'>

function doSubmit()
{
var myparent = self.opener;

myparent.document.foo.to.value='Testing';
}

</script>

<input type='button' value='Test' onclick='doSubmit()'>

</body>

</html>

Hope this helps!

ghoti

12:14 pm on Apr 23, 2003 (gmt 0)

10+ Year Member



wow, thanks for the help!

i figured i would probably have to use JavaScript or something to do this.

I am just a little hesitant with using JavaScript in my scripts, because sometimes some things don't work with all browsers.

I haven't checked it out, because i am at work right now but, does this example work with all browsers, including Netscape?

I am going to be selling this script, so it's quite essential that i have it work in every browser out there.

Thanks a lot for the replies. I got replies a lot quicker than i expected.

Thanks again!