Jump to content

Data insert help...


skendo

Recommended Posts

Where i am doing mistake..?

Is adding but it add's empty data :(

 

<head>

<title>Advertiser Signup</title>

</head>

<body bgcolor=white>

Welcome to signup Page<br>

<font color=red size=5>

<?php

$dbid = mysql_connect('localhost','xxxx','xxxxx');

mysql_select_db("xxxxxxx",$dbid);

$clientid = $_POST [dbInsertID];

$clientusername = $_POSTT[clientusername];

$clientpassword = $_POST[clientpassword] = md5($clientpassword);

$email = $_POST;

$clientmae = $_POST[clientname];

mysql_query("INSERT INTO my_clients (clientid, clientname, clientusername, clientpassword, email)

VALUES ('$clientid', '$clientname', '$clientusernmae', '$clientpassword', '$email')");

 

?>

 

</font>

<p><form method="post">

Name Surname:

<input type="text" name"$clientname" size="30" /><br />

E-mail:

<input type="text" name"$email" size="30" /><br />

Password:

<input type="text" name"$clientpassword" size="30" /><br />

Name Surname:

<input type="text" name"$clientusername" size="30" />

 

<input type="submit" value="Signup"

</form>

</body>

Link to comment
https://forums.phpfreaks.com/topic/243968-data-insert-help/
Share on other sites

Please put your code into the CODE TAGS.

 

<input type="text" name"$clientname" size="30" /><br />
E-mail:
<input type="text" name"$email" size="30" /><br />
Password:
<input type="text" name"$clientpassword" size="30" /><br />
Name Surname:
<input type="text" name"$clientusername" size="30" />

 

your missing names for your input types, and for some reason you have variables beside them

 

 

try this, but you don't have a input field for clientID ,

<head>
<title>Advertiser Signup</title>
</head>
<body bgcolor=white>
Welcome to signup Page<br>
<font color=red size=5>
<?php
$dbid = mysql_connect('localhost','xxxx','xxxxx');
mysql_select_db("xxxxxxx",$dbid);
$clientid = $_POST ['dbInsertID'];
$clientusername = $_POST['clientusername'];
$clientpassword = md5($_POST['clientpassword']);
$email = $_POST['email'];
$clientname= $_POST['clientname'];   
mysql_query("INSERT INTO my_clients (clientid, clientname, clientusername, clientpassword, email)
VALUES ('$clientid', '$clientname', '$clientusernmae', '$clientpassword', '$email')");

?>

</font>
<p><form method="post">
Name Surname:
<input type="text" name="clientname" size="30" /><br />
E-mail:
<input type="text" name="email" size="30" /><br />
Password:
<input type="text" name="clientpassword" size="30" /><br />
Name Surname:
<input type="text" name="clientusername" size="30" />

<input type="submit" value="Signup"
</form>
</body>

Link to comment
https://forums.phpfreaks.com/topic/243968-data-insert-help/#findComment-1252747
Share on other sites

I am going to pull my hair out today. You need to give your button a name. I suggest you read some basic HTML before tackling php.

 

try this.

<head>
<title>Advertiser Signup</title>
</head>
<body bgcolor=white>
Welcome to signup Page<br>
<font color=red size=5>
<?php
if($_POST['submit'] != ""){
$dbid = mysql_connect('localhost','xxxx','xxxxx');
mysql_select_db("xxxxxxx",$dbid);
$clientid = $_POST ['dbInsertID'];
$clientusername = $_POST['clientusername'];
$clientpassword = md5($_POST['clientpassword']);
$email = $_POST['email'];
$clientname= $_POST['clientname'];   
mysql_query("INSERT INTO my_clients (clientid, clientname, clientusername, clientpassword, email)
VALUES ('$clientid', '$clientname', '$clientusernmae', '$clientpassword', '$email')");
}
?>

</font>
<p><form method="post">
Name Surname:
<input type="text" name="clientname" size="30" /><br />
E-mail:
<input type="text" name="email" size="30" /><br />
Password:
<input type="text" name="clientpassword" size="30" /><br />
Name Surname:
<input type="text" name="clientusername" size="30" />

<input type="submit" name="submit" id="submit" value="Signup"
</form>
</body>

Link to comment
https://forums.phpfreaks.com/topic/243968-data-insert-help/#findComment-1252781
Share on other sites

and also instad of 1 it adds 2 rows at same time...

can some one give me a code example

 

That i can add data to database

 

that will ad random ID

Add username

Password

email

Name/Surname

 

I am a beginner so really need help.

 

Random ID is called a primary/unique Key with an auto_increment, every tables needs to have one, not always but depending on what your doing.

Link to comment
https://forums.phpfreaks.com/topic/243968-data-insert-help/#findComment-1252787
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.