insert data in mysql table

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

 



Hi everyone ,

I have created this Mysql table

CREATE TABLE questions (ID INT NOT NULL AUTO_INCREMENT, name VARCHAR(25), day DATE, question TEXT, email VARCHAR(30), PRIMARY KEY(ID));

And I am trying to insert data in it using the following

<body>

<?
if(isset($_GET['commented']))
{

echo("Your comment has been posted.");

$host = "********";
$user = "******";
$pass = "*****";
$db = "******";
$table = "questions";

$name = $_GET['form_uname'];
$question = $_GET['form_quest'];
$day = $_GET['form_day'];
$email = $_GET['from_email'];

mysql_connect($host,$user,$pass) or die(mysql_error());
mysql_select_db($db) or die(mysql_error());
$add_all = "INSERT INTO $table values('$name','$question','$day','$email','')";
mysql_query($add_all) or die(mysql_error());
}
else
{
?>
<form method="get" action="<? echo "$PHP_SELF " ; ?>" >
Name : <input type="text" name="form_uname">
<p>Question :<textarea rows="3" name="form_quest" cols="36"></textarea></p>
<p><br>
Date: <input type="text" name="form_day">
</p>
<p>Email: <input type="text" name="form_email"><br><br>
<input type= "hidden" name= "commented" value= "set" >
<input type="submit" value="Submit">
</p>
</form>
<?php
}
?>
</body>
Finally has a result to get the correct data only for the DATE and the data from the Question FORM goes to the name field. I do not know where the problem is. Help me please because I am going crazy,


Thanks in advance

Charalambos Nicolaou

_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail


--
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