?
Solved

retrieve for data

Posted on 2006-06-17
2
Medium Priority
?
279 Views
Last Modified: 2008-03-04
Hi Experts

The below code takes the results of a form and saves it to a mysql database. Im pretty new to PHP and have used tutorials to create the below code. Save to mysql works fine but when I try to constuct a sting it fails on line 30

$part2 = echo $_POST["firstname"];

Im trying to retrieve the fistname field of the form.

Hows do I do this please.

Many Thanks

Lee


<?php
$con = mysql_connect("localhost","web17-ebayorder","testtest");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("web17-ebayorder", $con);

$sql="INSERT INTO test
(firstname,lastname,address_line_1,address_line_2,town,county,postcode,domain_name,email,code)
VALUES
('$_POST[firstname]','$_POST[lastname]','$_POST[address_line_1]','$_POST[address_line_2]','$_POST[town]','$_POST[county]','$_POST[postcode]','$_POST[domain_name]','$_POST[email]','$_POST[code]')";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }

//echo "Success!";
?>

<frameset rows="*,300" frameborder="no" border="0" framespacing="0">
  <frame src="http://www.internetrunner.com" name="mainFrame" id="mainFrame" title="mainFrame" />
 
  <frame src=
<?PHP  

$part1 = "https://customer.heartinternet.co.uk/addpack.cgi?authcode=58499-raYeewU%2B9X;email="
$part2 = echo $_POST["firstname"];
$part3 = ";M_domain="
$part4 = echo $_POST["domain_name"];
$part5 = ";M_typeid=12345;status=Y";
echo $part1 $part2 $part3 $part4 $part5
?>
  name="bottomFrame" scrolling="No" noresize="noresize" id="bottomFrame" title="bottomFrame" />

</frameset><noframes></noframes>
0
Comment
Question by:ljhodgett
[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
  • 2
2 Comments
 
LVL 49

Expert Comment

by:Roonaan
ID: 16927423
You can use $part2 = $_POST['firstname'];

-r-
0
 
LVL 49

Accepted Solution

by:
Roonaan earned 500 total points
ID: 16927428
Same for $part4

Then change your echo $part1 $part2 $part4 $part5 either to:

echo htmlspecialchars("$part1 $part2 $part3 $part4 $part5");
or
echo htmlspecialchars($part1.$part2.$part3.$part4.$part5);

-r-

0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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 …
Suggested Courses

801 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