Hi
I am trying to create a form for new member to create an account. There are 2 php files. File 1 [nuform.php] is a form where user can enter their data for registration purpose. File 2 [nm.php] sends typed data to database. My problem is I cann't send MySQL query to database to add a new account. Can any one help me.
file 1 'nuform.php'
[code=php] <html>
<title> Member Information</title>
<?php
echo
"<form action='nm.php' method='post'>
<p>Login Name <input type='text' name='loginName '></p>
<p>Surname <input type='text' name=Surname'></p>
<p>First Name <input type='text' name='Firstname '></p>
<p>Select your Country</p>
<p><SELECT name="live"></p>
<p><option value="France"> France</p>
<p><option value="Spain">S pain</p>
<p><option value="Australi a">Australia </p>
<p><option value="United Kingdom">United Kingdom</p>
</SELECT>
<p><input type='Submit'></p>
</form>"
</html>
?>
file 2 'nm.php'
<?php
$user="username ";
$host="localhos t";
$password="pass word";
$database = "test";
$connection = mysql_connect($ host,$user,$pas sword) //open connection to MySQL
or die ("couldn't connect to server");
$db = mysql_select_db ($database,$con nection) // open session to Database
or die ("Couldn't select database");
$sql= "INSER INTO member (loginName, Surname, Firstname, live)values '".$_POST['loginName']." ".$_POST['Surname']." ".$_POST ['Firstname']." ".$_POST['live']."'"
?>[/code]
I am trying to create a form for new member to create an account. There are 2 php files. File 1 [nuform.php] is a form where user can enter their data for registration purpose. File 2 [nm.php] sends typed data to database. My problem is I cann't send MySQL query to database to add a new account. Can any one help me.
file 1 'nuform.php'
[code=php] <html>
<title> Member Information</title>
<?php
echo
"<form action='nm.php' method='post'>
<p>Login Name <input type='text' name='loginName '></p>
<p>Surname <input type='text' name=Surname'></p>
<p>First Name <input type='text' name='Firstname '></p>
<p>Select your Country</p>
<p><SELECT name="live"></p>
<p><option value="France"> France</p>
<p><option value="Spain">S pain</p>
<p><option value="Australi a">Australia </p>
<p><option value="United Kingdom">United Kingdom</p>
</SELECT>
<p><input type='Submit'></p>
</form>"
</html>
?>
file 2 'nm.php'
<?php
$user="username ";
$host="localhos t";
$password="pass word";
$database = "test";
$connection = mysql_connect($ host,$user,$pas sword) //open connection to MySQL
or die ("couldn't connect to server");
$db = mysql_select_db ($database,$con nection) // open session to Database
or die ("Couldn't select database");
$sql= "INSER INTO member (loginName, Surname, Firstname, live)values '".$_POST['loginName']." ".$_POST['Surname']." ".$_POST ['Firstname']." ".$_POST['live']."'"
?>[/code]
Comment