| | |
how to enter data in database from HTML form
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Aug 2009
Posts: 2
Reputation:
Solved Threads: 0
I am trying to use this script to enter data into my database from an html form. this code is not working. plz tell me where the error is
form is
and the action file is
form is
html Syntax (Toggle Plain Text)
<html> <head> <title> Review, Ratings, Opinions Site </title> </head> <body text="green" > <form action="register processing.php" method="post" > First name: <input type="text" name="fname" value="empty" /> <br/> Last name: <input type="text" name="lname" value="empty" /> <br/> Gender:<br/><input type="radio" name="sex" value="male" /> MALE <input type="radio" name="sex" value="female" /> FEMALE <br/> Email id: <input type="text" name="email" value="empty" /> <br/> Username: <input type="text" name="username" value="empty" /> <br/> password: <input type="password" name="password" value="empty" /> <br/> <input type="submit" name="submit" value="submit" /> </form> </body> </html>
and the action file is
php Syntax (Toggle Plain Text)
<?php $handle = mysql_connect("localhost", "root"); if(!$handle) die("mysql connection failed due to :" . mysql_error()); $db = mysql_select_db ("review_site" , $handle ); if(!db) die("database selection failed due to :" . mysql_error()); ?> <html> <head> <title> server side proceesing </title> </head> <body> <?php $fname = $_REQUEST['fname']; $lname = $_REQUEST['lname']; $sex = $_REQUEST['sex']; $email= $_REQUEST['email']; $username=$_REQUEST['username']; $password= $_REQUEST['password']; $v= 1; $sql = "INSERT INTO users(fname,lname,sex,email,username,password,visible) VALUES($fname,$lname,$sex,$email,$username,$password,$v)" ; if($result = mysql_query ($sql, $handle )) {echo "welcome " . $fname . "<br/>";} ?> </body> </html>
Last edited by Ezzaral; Aug 18th, 2009 at 4:39 pm. Reason: Added [code] [/code] tags. Please use them to format any code that you post.
![]() |
Similar Threads
- How to Insert/Edit data from TAG SELECT HTML Form to MySQL Database? (PHP)
- how to receive data from html form...? (HTML and CSS)
- Php page containing html form to sql database (PHP)
- get data from HTML form (Java)
- Retrving data from database to form (PHP)
- Error loading data from database (PHP)
- Cannot get php script to enter data (MySQL)
- Problem inserting data into database (JSP)
- Login and retrieve user data from database (ASP.NET)
Other Threads in the PHP Forum
- Previous Thread: Intergrating javascript with php / mysql
- Next Thread: update query
| Thread Tools | Search this Thread |
action address ajax apache api array auto beginner binary broken cakephp checkbox class classes cms code cron curl database date destroy display domain dynamic echo email error errorlog fatalerror file files folder form format forms function functions google href htaccess html if-else image include insert interactive ip java javascript joomla limit link load login mail malfunctioning masterthesis menu mlm multiple mysql nodes oop paypal pdf php popup problem query radio ram random record recursion reference remote return script search server sessions sms source space sql syntax system table tutorial unset update upload url validation validator variable video web websitecontactform youtube





