Re: [PHP-DB] javascript and submitting forms
This works! Thanks Adam On Tue, 2003-01-14 at 03:11, Adam Royle wrote: > Hi Mignon, > > This should work, never closing the window without submitting > (foolproof). Just add some error checking, and you'll be sweet as a > nut! All I did was add the echo statement underneath the data insert. > > Adam > > > include ('dbconn.php'); > if(isset($submit)) >{ > $query = "INSERT INTO `comments` ( `track_id`, `cat_comments` ) > VALUES ( '0', '$comm' );"; > mysql_query ($query, $link ); > > echo ' language="JavaScript">window.close(); html>'; > > } > ?> > > > > > > > > Enter your details here: > > > > > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] javascript and submitting forms
Thanks again for the advice. This approach wont work in this case because I'm launching the window from an app, then I need to close to return to the app. If I submit back to my app, it brings a new app into the addl window. And no, you're definetly not stupid ! Thanks for the help. Mignon On Mon, 2003-01-13 at 15:51, Micah Stevens wrote: > > Wait, I'm stupid. You're closing the window upon submission of the form, > so that will close the session, so the php at the beginning will never > process after form submission. Make the form submit to another page that > won't be closed. > > -Micah > > On Mon, 2003-01-13 at 13:24, Mignon Hunter wrote: > > > Unfortunately I havnt gotten it to work yet. Am I missing something ? > > > > PS the query works without the closewindow() > > > > > include ('dbconn.php'); > > if(isset($submit)) > > { > > $query = "INSERT INTO `comments` ( `track_id`, `cat_comments` ) VALUES > > ( '0', '$comm' );"; > > mysql_query ($query, $link ); > > } > > ?> > > > > > > > > > > > > > > > > > > > > Enter your details here: > > > > > > > onClick="return window.close();"> > > > > > > > > > > > > > > On Mon, 2003-01-13 at 14:44, Micah Stevens wrote: > > > The window.close(); function is not returning control to the form after > > > closing the window. You must tell it to do so. Use: > > > > > > onClick="return window.close();" > > > > > > This will return the window.close() value to the submit button so that > > > it can do its thing after the window has been closed. > > > > > > Use the same thing for the other form items too. > > > > > > Hope this helps. > > > -Micah > > > > > > > > > > > > On Mon, 2003-01-13 at 12:31, Mignon Hunter wrote: > > > > > > > Hello List, > > > > > > > > Has anyone had any problems using the onClick="window.close();" > > > > function within a input type = "submit" ? > > > > > > > > I'm trying > > > > > > > > > > > onClick="window.close();"> > > > > > > > > But evidently it's reading the close before the submit because the value > > > > of my form var is not being passed. > > > > > > > > I have also tried it in conjunction with a hidden field too. > > > > > > > > > > > > > > > onClick="window.close();"> > > > > > > > > If I dont use the onclick() the variable gets passed and/or entered into > > > > db just fine. > > > > > > > > Curious if anyone has had this problem or if anyone has any ideas...Thx > > > > Mignon > > > > > > -- > > > Raincross Technologies > > > Development and Consulting Services > > > http://www.raincross-tech.com > > > > > > > -- > Raincross Technologies > Development and Consulting Services > http://www.raincross-tech.com > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] javascript and submitting forms
Hi Mignon, This should work, never closing the window without submitting (foolproof). Just add some error checking, and you'll be sweet as a nut! All I did was add the echo statement underneath the data insert. Adam include ('dbconn.php'); if(isset($submit)) { $query = "INSERT INTO `comments` ( `track_id`, `cat_comments` ) VALUES ( '0', '$comm' );"; mysql_query ($query, $link ); echo 'window.close();'; } ?> Enter your details here: -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] javascript and submitting forms
Wait, I'm stupid. You're closing the window upon submission of the form, so that will close the session, so the php at the beginning will never process after form submission. Make the form submit to another page that won't be closed. -Micah On Mon, 2003-01-13 at 13:24, Mignon Hunter wrote: > Unfortunately I havnt gotten it to work yet. Am I missing something ? > > PS the query works without the closewindow() > > include ('dbconn.php'); > if(isset($submit)) >{ > $query = "INSERT INTO `comments` ( `track_id`, `cat_comments` ) VALUES > ( '0', '$comm' );"; > mysql_query ($query, $link ); > } > ?> > > > > > > > > > > Enter your details here: > > > onClick="return window.close();"> > > > > > > > On Mon, 2003-01-13 at 14:44, Micah Stevens wrote: > > The window.close(); function is not returning control to the form after > > closing the window. You must tell it to do so. Use: > > > > onClick="return window.close();" > > > > This will return the window.close() value to the submit button so that > > it can do its thing after the window has been closed. > > > > Use the same thing for the other form items too. > > > > Hope this helps. > > -Micah > > > > > > > > On Mon, 2003-01-13 at 12:31, Mignon Hunter wrote: > > > > > Hello List, > > > > > > Has anyone had any problems using the onClick="window.close();" > > > function within a input type = "submit" ? > > > > > > I'm trying > > > > > > > > onClick="window.close();"> > > > > > > But evidently it's reading the close before the submit because the value > > > of my form var is not being passed. > > > > > > I have also tried it in conjunction with a hidden field too. > > > > > > > > > > > onClick="window.close();"> > > > > > > If I dont use the onclick() the variable gets passed and/or entered into > > > db just fine. > > > > > > Curious if anyone has had this problem or if anyone has any ideas...Thx > > > Mignon > > > > -- > > Raincross Technologies > > Development and Consulting Services > > http://www.raincross-tech.com > > > -- Raincross Technologies Development and Consulting Services http://www.raincross-tech.com
Re: [PHP-DB] javascript and submitting forms
Nevermind Micah, Thanks for your input, I just did 2 buttons for the user - one to submit and one to close the window. Thanks for your help Mignon On Mon, 2003-01-13 at 15:24, Mignon Hunter wrote: > Unfortunately I havnt gotten it to work yet. Am I missing something ? > > PS the query works without the closewindow() > > include ('dbconn.php'); > if(isset($submit)) >{ > $query = "INSERT INTO `comments` ( `track_id`, `cat_comments` ) VALUES > ( '0', '$comm' );"; > mysql_query ($query, $link ); > } > ?> > > > > > > > > > > Enter your details here: > > > onClick="return window.close();"> > > > > > > > On Mon, 2003-01-13 at 14:44, Micah Stevens wrote: > > The window.close(); function is not returning control to the form after > > closing the window. You must tell it to do so. Use: > > > > onClick="return window.close();" > > > > This will return the window.close() value to the submit button so that > > it can do its thing after the window has been closed. > > > > Use the same thing for the other form items too. > > > > Hope this helps. > > -Micah > > > > > > > > On Mon, 2003-01-13 at 12:31, Mignon Hunter wrote: > > > > > Hello List, > > > > > > Has anyone had any problems using the onClick="window.close();" > > > function within a input type = "submit" ? > > > > > > I'm trying > > > > > > > > onClick="window.close();"> > > > > > > But evidently it's reading the close before the submit because the value > > > of my form var is not being passed. > > > > > > I have also tried it in conjunction with a hidden field too. > > > > > > > > > > > onClick="window.close();"> > > > > > > If I dont use the onclick() the variable gets passed and/or entered into > > > db just fine. > > > > > > Curious if anyone has had this problem or if anyone has any ideas...Thx > > > Mignon > > > > -- > > Raincross Technologies > > Development and Consulting Services > > http://www.raincross-tech.com > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] javascript and submitting forms
Unfortunately I havnt gotten it to work yet. Am I missing something ? PS the query works without the closewindow() Enter your details here: On Mon, 2003-01-13 at 14:44, Micah Stevens wrote: > The window.close(); function is not returning control to the form after > closing the window. You must tell it to do so. Use: > > onClick="return window.close();" > > This will return the window.close() value to the submit button so that > it can do its thing after the window has been closed. > > Use the same thing for the other form items too. > > Hope this helps. > -Micah > > > > On Mon, 2003-01-13 at 12:31, Mignon Hunter wrote: > > > Hello List, > > > > Has anyone had any problems using the onClick="window.close();" > > function within a input type = "submit" ? > > > > I'm trying > > > > > onClick="window.close();"> > > > > But evidently it's reading the close before the submit because the value > > of my form var is not being passed. > > > > I have also tried it in conjunction with a hidden field too. > > > > > > > onClick="window.close();"> > > > > If I dont use the onclick() the variable gets passed and/or entered into > > db just fine. > > > > Curious if anyone has had this problem or if anyone has any ideas...Thx > > Mignon > > -- > Raincross Technologies > Development and Consulting Services > http://www.raincross-tech.com > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] javascript and submitting forms
The window.close(); function is not returning control to the form after closing the window. You must tell it to do so. Use: onClick="return window.close();" This will return the window.close() value to the submit button so that it can do its thing after the window has been closed. Use the same thing for the other form items too. Hope this helps. -Micah On Mon, 2003-01-13 at 12:31, Mignon Hunter wrote: > Hello List, > > Has anyone had any problems using the onClick="window.close();" > function within a input type = "submit" ? > > I'm trying > > onClick="window.close();"> > > But evidently it's reading the close before the submit because the value > of my form var is not being passed. > > I have also tried it in conjunction with a hidden field too. > > > onClick="window.close();"> > > If I dont use the onclick() the variable gets passed and/or entered into > db just fine. > > Curious if anyone has had this problem or if anyone has any ideas...Thx > Mignon -- Raincross Technologies Development and Consulting Services http://www.raincross-tech.com
Re: [PHP-DB] javascript and submitting forms
Hello List, Has anyone had any problems using the onClick="window.close();" function within a input type = "submit" ? I'm trying But evidently it's reading the close before the submit because the value of my form var is not being passed. I have also tried it in conjunction with a hidden field too. If I dont use the onclick() the variable gets passed and/or entered into db just fine. Curious if anyone has had this problem or if anyone has any ideas...Thx Mignon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php