Re: javascript and submitting forms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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>


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux