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' - <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">Spain</p>
-
<p><option value="Australia">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="localhost";
-
$password="password";
-
$database = "test";
-
-
-
$connection = mysql_connect($host,$user,$password) //open connection to MySQL
-
or die ("couldn't connect to server");
-
-
-
$db = mysql_select_db($database,$connection) // 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']."'"
-
-
?>
11 1499
USe code tags to display code on this forum.
You don't need to insert your own numbers if you do this.
Thanks.
USe code tags to display code on this forum.
You don't need to insert your own numbers if you do this.
Thanks.
thanks for telling me
To debug this, echo the $sql statement before the insert so you can check that it is correct and change the mysql_query die part as[php]or die ("Couldn't execute query: ".mysql_error());[/php] and you will see any error.
Ronald
To debug this, echo the $sql statement before the insert so you can check that it is correct and change the mysql_query die part as[php]or die ("Couldn't execute query: ".mysql_error());[/php] and you will see any error.
Ronald
Thanks Ronverdonk... Its working now...
Line 41.
Use commas between the variables.
[EDIT]
Ignore this if you already solved.
Line 41.
Use commas between the variables.
[EDIT]
Ignore this if you already solved.
You are right, there were silly mistakes in line 41. Thanks for your help;
regards
Infoseekar
You are right, there were silly mistakes in line 41. Thanks for your help;
regards
Infoseekar
Also tell me, is the echo statement at line 5 working?
Also tell me, is the echo statement at line 5 working?
No, I have deleted that statement now..
No, I have deleted that statement now..
Use \" when you have to send a quote to the html.
eg. <SELECT name=\"live\">
Use \" when you have to send a quote to the html.
eg.<SELECT name=\"live\">
thank you very much.. you have been very helpful..
You are welcome. :)
Harpreet
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Bill |
last post by:
I'm having what seems to me to be an odd problem. Perhaps there is some
explanation, but don't know at this point. Basically I have a form that
tracks memberships and donations. The main form...
|
by: |
last post by:
I am having trouble figuring out to call a database INSERT procedure from a
simple submit form.
It appears I should use the onclick event to trigger the procedure called
BUT when I do this I...
|
by: Peter Nurse |
last post by:
For reasons that are not relevant (though I explain them below *), I
want, for all my users whatever privelige level, an SP which creates
and inserts into a temporary table and then another SP...
|
by: chumlyumly |
last post by:
Hello scripters -
OS: Mac OSX
Language: PHP w/ MySQL database
I've created an insert page where a user inputs his info, which then goes to four different tables in a MySQL database. The...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |