Drew,
Thanks for the good advice I can now get cookies to work in functions. I have tried to apply your good advice to a form function I was working on.
2 problems have arisen.
Problem 1: The basic idea is to have the form reload when the "Country" field is changed. When the Form re-loads cookies are set with values already entered in other fields, so that when the reloading is finished the entries are preserved. I did this by the following code:
<td><select name= "country" onChange="window.location=('testform.php');
writeCookie('cCountry', country.options[country.selectedIndex].value, .02);
writeCookie('cFname', window.first_name.value, .02);
writeCookie('cLname', window.last_name.value, .02);
writeCookie('cCity', window.city.value, .02);
writeCookie('cZip', window.zip.value, .02);
writeCookie('cPhone', window.phone.value, .02);
writeCookie('cMail', window.email.value, .02);
writeCookie('cBand', window.band_name.value, .02);
writeCookie('cNumMem', window.num_members.value, .02);
writeCookie('cAddress', window.address.value, .02);
writeCookie('cGenre', genre.options[genre.selectedIndex].value, .02);
"> <?php dynamic_menu(nation, $change_var); ?> //<- dynamic drop down
</td></tr>
The first problem is this solution only works on the safari browser. Other browser such as Mozilla and IE do not retireve the cookie values and the other fields remain blank. What is strange is the Drop Down menus new value which is also stored in a cookie IS Retrieved. I tried to use your "header()" solution by replacing the "window.location" command with <? header(Location: 'testform.php')?> however it fails to load the page and warns me I have too many headers.
Problems #2 is just that I would like the whole
solution to be in php and not javascript. That is why I liked your header solution.
Again any help by all would be great!
Thanks Again
Gomer