Computing.Net > Forums > Web Development > PHP Form saving to mySQL

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

PHP Form saving to mySQL

Reply to Message Icon

Name: kyleinc
Date: June 22, 2004 at 17:21:00 Pacific
OS: linux
CPU/Ram: ?
Comment:

I am rewriting my web site in php to take advantage of mySQL. Currently, I am trying to take the contents of a text field (like the kind one types in to make a post on this board) of a form and save it to an entry in my SQL database. However, being new to php and all, I don't exactly know how to accomplish this. Can anybody point me in the right direction?



Sponsored Link
Ads by Google

Response Number 1
Name: anonproxy
Date: June 22, 2004 at 18:23:47 Pacific
Reply:

It's fairly simple. CGI-like behavior means that scripts and the server exchange data (that's the short version). In PHP, there are global arrays, called superglobals, which hold user input via HTML forms. By specifying in the HTML form "action:" field a PHP script which is ready to use data in a superglobal, the server fills the array(s) with form data when the submit request is sent. In this way, the script is executed and gets immediate access to the user's input.

Using MySQL involves opening a connection (which means loging in to mysqld, the database server), filling in an SQL query with some data from the HTML form, and submiting it to mysqld. Of course, you should have a table already setup to be filled.

Try Google for "php html form input" and maybe through mysql in there too. The PHP online manual at php.net covers things like superglobals and mysql functions. This topic is covered extensively in most books about PHP as well.



0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: PHP Form saving to mySQL

Form to MySQL Database - Need help! www.computing.net/answers/webdevel/form-to-mysql-database-need-help/3159.html

php form not work www.computing.net/answers/webdevel/php-form-not-work/2423.html

PHP connection to MySQL www.computing.net/answers/webdevel/php-connection-to-mysql/235.html