Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Power Lifting Lever Belt
SkullVamp
Updated:
Yesterday at 10:32 PM
Ad icon
port.lk Domain for sale
Lankan-Tech
Updated:
Yesterday at 3:55 PM
Colombo
Kaduwela - Two Storey House for Sale
dilrasan
Updated:
Thursday at 2:23 PM
Ad icon
Wechat qr verification
Pawan2005
Updated:
Thursday at 1:28 AM
🚀 GOOGLE AI PRO 18 MONTHS ACTIVATION 🚀
sayuru bandara
Updated:
Wednesday at 5:34 PM
Electronics
Vehicles
Property
Search
Reply to thread
Forums
Computers & Internet
Software Development
Help Plzzzzzzz (PHP/MySQL)
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="ishara4me" data-source="post: 6522135" data-attributes="member: 5229"><p>First you need a web server to work with php.Not like html , PHP is a server-side scripting language.So PHP code is executed on the server, and the plain HTML result is sent to the browser.</p><p>You can use apache & mysql (have to configure) ,XAMPP or WAMP.</p><p>In apache all files you wish to host, have be in htdocs folder .So your pages have save in the htdocs folder.</p><p>after saving files in htdocs, you have to start apache and mysql servers.After that you can access you pages as "http://localhost/xxxxx". xxxxx is the page name.</p><p>Finally following two pages have to save in htdocs folder in apache or in XAMPP or in WAMP.</p><p>Further you can modify the cod as you wish but this is the basic code for ur requirement.</p><p>I think this will help u to start... <img src="/styles/default/xenforo/smilies/default/D.gif" class="smilie" loading="lazy" alt=":D" title="Big grin :D" data-shortname=":D" /></p><p> </p><p></p><p>==========================================================</p><p>This is a sample code runs in client side.That means form which is going to see the user.You enter data from this page.</p><p></p><p>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</p><p></p><p><html></p><p><head><title>Text you want to see as title</title></head></p><p><body></p><p></p><p>/*form begins here*/</p><p>/*Codes that saves ur data are in insert.php page.So action of the form should be that page.(insert.php)*/</p><p></p><p><form action="insert.php" method="post"></p><p></p><p>/*You can use any label for text boxes and any layout.(ex. You can use tables or Div areas to allign ur fields).So list of text areas should mentioned at least with their "name" attribute.Instead of text boxes you can use check boxes or drop downs for user inputs. Important thing is at least they should have a unique name*/</p><p></p><p>Text Box 1<input type="text" name="field1" /></p><p>Text Box 2<input type="text" name="field2" /></p><p>Text Box 3<input type="text" name="field3" /></p><p></p><p>/*your data will post to insert.php using a button click.So we have to submit data to other page.Then button type should be as "submit".in "value" attribute you can give any name you want to see on the button*/</p><p></p><p><input type="submit" value="save" /></p><p></form></p><p></p><p>/*form ends here*/</p><p></p><p></body></p><p></html></p><p></p><p>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</p><p></p><p>This is the insert.php page which is going to run in server side.This should save as insert.php(you can give any name which have given as the action of the form of previous page)</p><p></p><p><?php</p><p>/*connect to the database.Parameters are host name , user name , password. If you run this in ur local machine host name is localhost.in this code root is the username and root123 is the password .There can be many databases in ur database collection.So you have to give the name of the database name which has the tables for your entering data."database_name" is the database name you are going to use.*/</p><p>$con = mysql_connect("localhost","root","root123");</p><p>if (!$con)</p><p> {</p><p> die('Could not connect: ' . mysql_error());</p><p> }</p><p></p><p>mysql_select_db("database_name", $con);</p><p></p><p>/*Sql query will runs from here."Persons" is the table name in the "database_name" database. (field1, field2, field3) are the fields in the table which are holding ur data .. $_POST[field1]','$_POST[field1]','$_POST[field1] are the values that u send from the previous page*/</p><p></p><p>$sql="INSERT INTO Persons (field1, field2, field3)</p><p>VALUES</p><p>('$_POST[field1]','$_POST[field1]','$_POST[field1]')";</p><p></p><p>if (!mysql_query($sql,$con))</p><p> {</p><p> die('Error: ' . mysql_error());</p><p> }</p><p>echo "1 record added";</p><p></p><p>mysql_close($con)</p><p>?></p></blockquote><p></p>
[QUOTE="ishara4me, post: 6522135, member: 5229"] First you need a web server to work with php.Not like html , PHP is a server-side scripting language.So PHP code is executed on the server, and the plain HTML result is sent to the browser. You can use apache & mysql (have to configure) ,XAMPP or WAMP. In apache all files you wish to host, have be in htdocs folder .So your pages have save in the htdocs folder. after saving files in htdocs, you have to start apache and mysql servers.After that you can access you pages as "http://localhost/xxxxx". xxxxx is the page name. Finally following two pages have to save in htdocs folder in apache or in XAMPP or in WAMP. Further you can modify the cod as you wish but this is the basic code for ur requirement. I think this will help u to start... :D ========================================================== This is a sample code runs in client side.That means form which is going to see the user.You enter data from this page. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ <html> <head><title>Text you want to see as title</title></head> <body> /*form begins here*/ /*Codes that saves ur data are in insert.php page.So action of the form should be that page.(insert.php)*/ <form action="insert.php" method="post"> /*You can use any label for text boxes and any layout.(ex. You can use tables or Div areas to allign ur fields).So list of text areas should mentioned at least with their "name" attribute.Instead of text boxes you can use check boxes or drop downs for user inputs. Important thing is at least they should have a unique name*/ Text Box 1<input type="text" name="field1" /> Text Box 2<input type="text" name="field2" /> Text Box 3<input type="text" name="field3" /> /*your data will post to insert.php using a button click.So we have to submit data to other page.Then button type should be as "submit".in "value" attribute you can give any name you want to see on the button*/ <input type="submit" value="save" /> </form> /*form ends here*/ </body> </html> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ This is the insert.php page which is going to run in server side.This should save as insert.php(you can give any name which have given as the action of the form of previous page) <?php /*connect to the database.Parameters are host name , user name , password. If you run this in ur local machine host name is localhost.in this code root is the username and root123 is the password .There can be many databases in ur database collection.So you have to give the name of the database name which has the tables for your entering data."database_name" is the database name you are going to use.*/ $con = mysql_connect("localhost","root","root123"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("database_name", $con); /*Sql query will runs from here."Persons" is the table name in the "database_name" database. (field1, field2, field3) are the fields in the table which are holding ur data .. $_POST[field1]','$_POST[field1]','$_POST[field1] are the values that u send from the previous page*/ $sql="INSERT INTO Persons (field1, field2, field3) VALUES ('$_POST[field1]','$_POST[field1]','$_POST[field1]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con) ?> [/QUOTE]
Insert quotes…
Verification
Payakata winadi keeyak tibeda?
Post reply
Top
Bottom