The string is in double quotes, ont single quotes. The single quotes are simply characters in the double-quoted string. I believe the register_globals explanation is correct.

Brent Baisley wrote:

I'm pretty sure your problem is the single quotes around your variables. Single quotes and double quotes have very different meanings. Single quotes tell PHP not to look for anything inside the quotes, whereas PHP will always parse double quotes to see if there is anything it needs to process. There is obviously a slight performance advantage to using the correct quotes religiously.

Change you query string to something like:
mysql_query ("INSERT INTO name (name,surname)
VALUES (\"$name\",\"$surname\")");
or
mysql_query ('INSERT INTO name (name,surname)
VALUES ("'.$name.'","'.$surname.'")');

On Friday, March 14, 2003, at 10:39 AM, Mahmut KARADEMIR wrote:

Hi All;
I am trying to add a new record web database using Mysql&PHP.
But after at every add process a new blank record is added to mysql table.
The entered text is not considered with codes.
What is my trouble in this html or php code?
Could anyone has any idea?
Thanks.
***************name.html******************
<html>
<body>
<form action="name.php" method="post">
<PRE>
name...... : <input
type="text"
name="name"
size="25"
maxlength="25"
value="<? echo $name>">
<P>
surname: <input
type="text"
name="surname"
size="25"
maxlength="25">
< input type="submit"
name="submit"
value="submit">
</PRE>
</form>
</body>
</html>
*******************name.php***************
<?php
mysql_connect("localhost","user","password");
mysql_select_db ("mydatabasename");
mysql_query ("INSERT INTO name (name,surname)
VALUES ('$name','$surname')");
echo ('Your record has been added.');
print ("<p>");
print ("Your Name:");
print ($name);
print (" ");
print ("<p>");
print ("Your Surname:");
print ($surname);
print ("<p>");
print ("THANKS");
?>



Mahmut


--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577



-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.




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



Reply via email to