Add a phpinfo(); to the script and see what is getting passed to the page. That has worked wonders for me. -Dave > > From: "Aalee" <ayyaali@xxxxxxxxxxx> > Date: 2004/11/05 Fri AM 07:25:20 EST > To: php-general@xxxxxxxxxxxxx > Subject: This is weird..whts the prob??? > > Hi guys, > Working on PHP ver 4.3.8 with register_globals turned OFF and Apache 1.3.31. > MySQL ver 4.0.20a on winXP pro SP1. This script does not seems to work with > the method of POST. When I change it to GET method the data is entered into > the database, but with POST it does not. I have another script with the POST > method, but that script works with POST. What is wrong with this script. > Here goes the script. What am I doing wrong. > > <?php > if (isset($_GET['addjoke'])){ > ?> > > <form name="form1" method="post" action="<?php $_SERVER['PHP_SELF']; ?>"> > Type your joke :<br> > <textarea name="jokeText" id="jokeText"></textarea> > <br> > <input name="insert" type="submit" id="submit" value="Insert Joke"> > </form> > > > <?php > } > else { // start main else statement > if(isset ($_POST['insert'])) { > $db = mysql_connect("localhost","homesite","ju4754") ; > mysql_select_db("jokes",$db); > $query = mysql_query("INSERT INTO jokes SET > JokeText = '".$_POST['jokeText']."' , > JokeDate = CURDATE() "); > echo $query; > echo " Joke inserted, Thank you <BR><BR>"; > echo mysql_error(); > } > $color1 = "#66CCFF"; > $color2 = "#66CC99"; > $row_count = 1; > > // ---------- Following lines list the jokes in the > database ---------------- > echo "<b><H3> These are the jokes we have got so far</H3></B>"; > $db = mysql_connect("localhost","homesite","ju4754") or die(mysql_error()); > mysql_select_db("jokes",$db); > $sql = "SELECT id, JokeText, JokeDate from jokes"; > $query = mysql_query($sql); > echo "<table border=1> > <tr> > <td><b>ID<b></td> > <td><b>Joke Text<b></td> > <td><b>Joke Date<b></td></tr>"; > while ($myrow = mysql_fetch_array($query)) > { > $row_color = ($row_count % 2) ? $color1 : $color2; > echo"<tr bgcolor = $row_color>". > "<td>". $myrow["id"]."</td>". > "<td>". $myrow["JokeText"]. "</td>". > "<td>". $myrow["JokeDate"]."</td></tr>"; > $row_count++; > } > echo "</table>"; > > $current_url = $_SERVER['PHP_SELF']; > echo("<P><A HREF=".$current_url."?addjoke=1>" ."Add a Joke!</A></P>"); > > > } // end main else statement > ?> > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php