Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

What steps I need to make to insert the content of a form in a mysql data base with php?

Posted on 2008-06-24
3
Medium Priority
?
276 Views
Last Modified: 2010-04-21
I recently have made a form in php that sends via email the content of it (to the asigned email). Now, I want to change this to insert the content in a mysql database with php, and I´m not sure the way that I must to do. I think, first I must create a table in my mysql database? Second,  this code must change? how?
e.g. $body .= "Deaprture: " . $_POST["port"] . "\r\n"
0
Comment
Question by:juanico
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 36

Accepted Solution

by:
Loganathan Natarajan earned 90 total points
ID: 21854774
yes, you will have to create tables and store it

ref. http://www.w3schools.com/PHP/php_mysql_insert.asp
0
 
LVL 29

Assisted Solution

by:fosiul01
fosiul01 earned 60 total points
ID: 21855320
Hi juanico,
The previous link will show you how to connect database and how to insert data into record

Now what you will have to do is :

if you follow the previous link , bellow line :

mysql_query("INSERT INTO person (FirstName, LastName, Age)
VALUES ('Peter', 'Griffin', '35')");

where the value is inputted statically
but in your case value would inputed dynamically

Like in the mail proramm, you have variables such as ( as you said in your pose)
$body .= "Deaprture: " . $_POST["port"] . "\r\n"

Now here  ,instead of peter use $body
which would be like this

mysql_query("INSERT INTO emailtable (emailaddress,subject, body)
VALUES ($emailaddress,$subject,$body)");

thats it, job done. and  you will have to write this insert statement, in Submit button just after sending the email


0
 

Author Closing Comment

by:juanico
ID: 31470104
I only want to say thank you!!!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question