outputting db form data

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
cbcampbell
Forum Newbie
Posts: 19
Joined: Mon Jun 09, 2003 12:12 am

outputting db form data

Post by cbcampbell »

I am needing help with a form. Senario...

I have a form that asks for a firstname, lastname, phone, and problem description. When they click on "submit", it sends them to a confirmation page, which, says thanks and also inserts the record into the mysql database. Now, what I can't get my script to do, is to also, with the thank you, display the information they just entered into the form. I can get it to output all the records, but i can't get it to output what the user has just inputed into the form. Instead, it displays all the records. Any help would be appreciated.
User avatar
delorian
Forum Contributor
Posts: 223
Joined: Sun May 04, 2003 5:20 pm
Location: Olsztyn, Poland

Post by delorian »

If you using POST method in your form, the form output should look something like this:

Code: Select all

echo "Firstname: ".$_POST['fistname']."<br/>";
echo "Lastname: ".$_POST['lastname']."<br/>";
echo "Phone: ".$_POST['phone']."<br/>";
echo "Problem description: ".$_POST['problem']."<br/>";

// But of course you should also use strip_tags or htmlspecialchars functions to write more secure code. See the manual for more details.
Post Reply