i currently have a web-based email system on my server. When composing an email I have a form on the page that has the standard to: and cc: inputs. I have a link on the side that says 'addresses', when clicked, this will open up another window which takes the users addresses from the db and places them on the page with two check boxes next to each name - one for to: and one for cc:. The user can select which emails go into the to: and/or the cc: - and when they hit the submit button the checked emails go into the corresponding input boxes on the original page and all is well.
however, I found that if they want to add another email and they click on addresses again and selected an email and submit it, it will send the new email, but the others, of course, will be gone. I need a way to send info to a javascript openwindow function through a link - it cant be a form submission because there is already one form on the page. The compose page is a php page which calls a function to write out the openwindow javascipt function. So php is generating the javascript function and im wondering if I could do this by writing another javascript function inside the javascipt that opens up the new window?
does anyone get this or am i just staying up too late these days?
thanks
I read that 3 or 4 times to get the gist of it.
I am still a little confused, when you click on the "addresses" link is it js or php that creates the new window? I think I understand that it is a javascript function that was written by php.
could you post to the new window and have it check off what was already selected and then when it returns the addresses would be updated?
maybe you could just append the new addresses to the existing string.
I think a little clarification on specifics would help.
and yes - that is what im trying to do- send the information the user has inputed to the newly open window so that they could see what they have already selcted. the problem is i cant figure out a way to do it because i need some way to send information that the user has inputed when someone clicks on that link. it would be easy if i could just make addresses a button, but i cant since there is already a form on the page.
so i was wondering if, when the user clicks on addresses, the link will go to the javascript function and then somehow grab the values from the to: and cc: inputs and shoot those to the php to parse and enter back into the page. so i guess im just looking for an easy way to grab the values from input boxes directly from a link.
thanks
I'm still a little confused about what you're looking for.
It sounds as though what you need is is basically javascript that takes the results of a script (run in a window) and pastes them into a form...
I've seen stuff like this and will dig out the references if it's what you need.
if (email == email address) {
echo ("Sorry, in Javascript you can't pass values from page to page.\n");
echo ("You need to somehow save state in your php script, so you won't lose those email addresses that were selected first, right?\n");
echo ("Write them to a text file? Or temporarily store them in your database?");
}
You can - it ain't easy though - to see it in action visit this spellchecker
[dontpokebadgers.com...]
At the bottom see the test spelling - pops up a new window - you fix your spelling and it pastes the results back into the original window. Give it ago - I was impressed ;)
when someone clicks the addresses link in the compose page, instead of calling the javascript function to open the new window, ill just call another javascript function to grab the values in the to and cc input boxes. then from that function ill call the open window fucntion and send those variables to that function. then ill have javascript write out the html for that page and shoot the variables into a couple hidden fields in the form and then parse them with php to grab each individual email....
if that doesnt work instead of having javascript write out the htmlcode for the new window, ill just create another php file that javascript will call to open up inside the new window. when the user clicks on addresses, it will call a function that will grab the variables in the input boxes and create a variable like
thispage = phpfile.php?to='varto'&cc='varcc'
and then I can just open that page up into the new window.
think it will ever fly?
This [examples.oreilly.com] use of the Location object (javascript) might come in handy.
Hope it works out.
If you don't need to worry about any of the problems associated with frames vis. SE spiders, you could put your address list (clickable nicks) in a narrow, scrollable column; each one a link to a javascript pop-up holding details (full name, location, blah) and checkboxes for to: and cc:. On submission this data would be written to your db. The sender could then keep selecting (and popping-up) addresses and saving them to the db until satisfied. The recipients addresses would be extracted from the db, and placed in the mail() function, only upon submission of the email message (Send).
Not quite as cool as what you originally had in mind but a lot less confusing, especially to code. ;)