Re: javascript and submitting forms

From: Date: Tue, 14 Jan 2003 09:11:19 +0000
Subject: Re: javascript and submitting forms
Groups: php.db 
Request: Send a blank email to php-db+get-24826@lists.php.net to get a copy of this message
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 '<html><head><script language="JavaScript">window.close();</script></head><body></body></html>'; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title></title> </head> <body> <form action="comp_page3.php" method="POST"> Enter your details here:<br> <textarea name="comm" rows="15" cols="30"></textarea><br> <input type="submit" name="submit" value="Close and Save"> </form> </body> </html>

« previous php.db (#24826) next »