Go Premium for a chance to win a PS4. Enter to Win

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
?
277 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
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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
In this article, we’ll look at how to deploy ProxySQL.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

824 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