need some help

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
Steve0101
-


Joined: 13 Nov 2003
Posts: 28

PostPosted: Sun Dec 21, 2003 5:38 am    Post subject: need some help Reply with quote

I am trying to work out a script so that when some body enters there info in a form I have made it will add it to the data base but it does not work and I have tried alot of things but still no luck here is the from code

<form method="POST" action="register.php">
<p align="center">
Thank you for wanting to be part of sim pet</p>
<p align="center">
Nickname<input type="text" name="nick_name" size="20"></p>
<p align="center">Password<input type="password" name="Password" size="20"></p>
<p align="center">Password again<input type="password" name="Password2" size="20"></p>
<p align="center">E-mail<input type="text" name="email" size="20"></p>
<p align="center">Real Name<input type="text" name="realname" size="20"></p>
<p align="center">Age<input type="text" name="age" size="20"></p>
<p align="center"><br>
<input type="submit" value="Register" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>




and then the php code on the next page


<?php
require_once ('C:/Program Files/Abyss Web Server/connect.php');

if ("SUBMIT" == $B1) {
$dbc = "INSERT INTO users " .
"nick_name='$nickname', " .
"password='$Password', " .
"email='$email', " .
"name='$realname', " .
"age='$age', " .
"registration_date=CURDATE()";
if (mysql_query($dbc)) {
echo("<P>You have been add to Sim Pet.</P>");
} else {
echo("<P>Error : " .
mysql_error() . "</P>");
}
}



mysql_close();

echo "Nick Name entered: $nickname";
echo "<br />Password entered: $Password\n\n";
echo "<br />Email entered: $email\n\n";
echo "<br />Your real name: $realname\n\n";
echo "<br />Your age: $age\n\n";
?>

I am very new to php and mysql so i am learning as i go any help on this would be great :lol:
Back to top View user's profile Send private message Send e-mail
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Sun Dec 21, 2003 2:45 pm    Post subject: Reply with quote

Ok it looks as if the PHP code you where writing is from the old varibals.
Try the form again having Register Globals = On and tell us if it works.

A correct way to write a new varibal within php is

New Varibal:
Code:
$_REQUEST[name]


I use new varibals so I don't have to have Register Globals = On
For my Virtual Host Creator program loacted http://www.multiple-sites.tk
Back to top View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group