p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   PHP Databases (http://p2p.wrox.com/forumdisplay.php?f=97)
-   -   PHP-MySQL Insert Data problem (http://p2p.wrox.com/showthread.php?t=54959)

forexen March 6th, 2007 04:51 AM

PHP-MySQL Insert Data problem
Hi Everyone,

I am using php-mysql, the problem is it can't insert the data into mysql after i have click submit button. The source code is like :

$db = mysql_connect("localhost", "root", "") or die(mysql_error());

    mysql_query("INSERT INTO registration (fname,username,Password,ic,address,state,city,pos talcode,phoneno,dob,Email,Gender,safety_question,a nswer) VALUES('".$_POST["fname"]."','".$_POST["username"]."','" .$_POST["Password"]. "','".$_POST["ic"]."','".$_POST['address']."','".$_POST['state']."','".$_POST["city"]."','".$_POST["postalcode"]."','".$_POST["areacode"].$_POST["number"]."','".$_POST["year"].$_POST["month"].$_POST["day"]."','" .$_POST["Email"]."','" .$_POST["Gender"]."','" .$_POST["safety_question"]."','" .$_POST["answer"]."')");

mysql_query("INSERT INTO login (username,Password,Status) VALUES ('".$_POST["username"]."','".$_POST["Password"]."','Inactive')");

    $success = "Register+Successfully";
    header ("Location: $URL");

$Name = $_POST["username"];
$Password = $_POST["Password"];



prashu_hi25 March 13th, 2007 12:58 AM

Hi forexen,

Is the form method which are u r submiting the data is "GET" method or "POST" method.

Since the data u r entering into database all are $_POST method but the form method u using is $_GET method.

First u check whether it going to the $_GET["ActionMode"]=="register02"
loop by echoing some thing.

I hope this will help u.

All times are GMT -4. The time now is 03:51 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.