RE: [PHP]PHP script and new window.

From: Date: Tue, 24 Apr 2001 14:00:23 +0000
Subject: RE: [PHP]PHP script and new window.
Groups: php.general 
Request: Send a blank email to php-general+get-50071@lists.php.net to get a copy of this message
ok, this issue seems to be deeper than what I thought. I'll start from the beginning. I have a survey on my site built in php. Is what I would like to do is after the user votes, have the results pop-up in a new window. The survey is working so far as, if I remove the window.open the results will display in the same browser window in a new page and the db will be updated. However, when I add the onClick event handler the window that pops up is blank and the database does not get updated. The source in the pop-up window reads </body></html>. I have three files... index.phtml which is the main page and I use include("poll.php"); on the index.phtml file to write out the poll. Then there is the vote.php which is used to update the db and display the results. Whew.. long winded. Hopefully that will clear anything up. p.s. If I change type="submit" to type="button" the pop-up window will load the index.phtml page. If anyone needs more code snippets or anything please.. let me know. Thanks again. CAA -----Original Message----- From: Plutarck [mailto:aemuli@spamclause-yahoo.com] Sent: Monday, April 23, 2001 7:11 PM To: php-general@lists.php.net Subject: Re: [PHP]PHP script and new window. First of all, I believe since you are using javascript on your button you shouldn't use type="submit". Change it to type="button", which means it will have no effect for browsers that don't have javascript enabled when clicked. That could be an error, for one. But then again, it might not. It might cause it to be submitted to one page and opened on another, which very well may be what you want to happen. However it might be that the window is being opened first then the data is submitted second, thus the error that's being caused. To fix it just add the window.open function in the <head> area of your document, so that as soon as the page is viewed the window pops up. Annoying if the user hits refresh, but what you could do is use a Meta-Refresh to take them from the page that pops up the window to the page that user should be normally seing. Next, how is it that you are getting the data and what data are you getting? For instance, are you using the id you are submitting to the other page to see how that user voted? Or are you just tracking who's viewing that page? Further, does what you are displaying depend on what id is being submitted? Lastly, view source on your HTML page and ensure all the fields are getting filled out like you expect them to. It happens all the time that by using View Source I find what my problem was. -- Plutarck Should be working on something... ...but forgot what it was. ""Angerer, Chad"" <cangerer@ibsys.com> wrote in message news:9E35C54B0C7AD411B5C1009027DE539940B5EF@MSPMX01... > I have searched high and low for thos but with no luck. Hopefully someone > will give me some good pointers. > > I have a poll on a page that I am building which uses php. I would like to > have a new window open when the submit and view results links are selected. > I am using an onClick and the view results window works fine. It is the > submit button I am having trouble with. The new window won't populate with > any info. > > Here is the form that I have on my page > > <form method="post" action="vote.php"> > <div class="pollTitle"><? echo $question; ?></div> > <div class="pollResponse"> > <input type="Radio" name="response" value="1"><? echo > $response1; > ?><br> > <input type="Radio" name="response" value="2"><? echo > $response2; > ?><br> > <input type="Radio" name="response" value="3"><? echo > $response3; > ?><br></div> > <input type="hidden" name="id" value="<? echo $id; > ?>"> > <font size=-2><a href="#" > onClick="window.open('archive.php?id=<? > echo $id; > ?>','archive','toolbar=no,status=no.location=no,menubar=no,top=50,left=50,he > ight=250,width=200,scrollbars=no'); return false;">view > results</a></font><br><br> > <input type="submit" name="submit" value="Vote" > onClick="window.open('http://www.askedagain.com/vote.php','vote','toolbar=no > ,status=no.location=no,menubar=no,top=50,left=50,height=250,width=200,scroll > bars=no'); return false;"> > </form> > > The vote script works fine as if I just have it load in the current browser > window. Is there something that I am missing? Any help and/or ideas are > much appreciated. > > Thanks again. > > CAA > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#50071) next »