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
274 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 30 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 20 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

627 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