PDF Submit and $_POST
Moderator: General Moderators
-
littlemetz85
- Forum Newbie
- Posts: 10
- Joined: Mon Jul 23, 2007 5:23 pm
PDF Submit and $_POST
I've been working on this project for awhile now but still can't get it to work so I'm turning to all of you for some help. I have made a PDF application with a HTTP submit button at the bottom. This submits to a php script that I have on my server. What I want to do is to take the submitted data and save it as an XML file on my server. I have been using the $_POST method to get the data sent to the script but it puts it in an array. I can't figure out from here how to make it into an XML file. Any suggestions?
Thanks, Paul
Thanks, Paul
-
littlemetz85
- Forum Newbie
- Posts: 10
- Joined: Mon Jul 23, 2007 5:23 pm
-
littlemetz85
- Forum Newbie
- Posts: 10
- Joined: Mon Jul 23, 2007 5:23 pm
when I do a print_r($_POST) this is what shows:
PaulAddress=123 Fake LaneCity=MyCityCellPhoneNumber=1234567891Email=MyMail@Gmail.com
I also get the same output using:
foreach ($data as $variable) {
echo "$variable";
}
It shows all my form data but is missing the name of the first text box.
PaulAddress=123 Fake LaneCity=MyCityCellPhoneNumber=1234567891Email=MyMail@Gmail.com
I also get the same output using:
foreach ($data as $variable) {
echo "$variable";
}
It shows all my form data but is missing the name of the first text box.
- iknownothing
- Forum Contributor
- Posts: 337
- Joined: Sun Dec 17, 2006 11:53 pm
- Location: Sunshine Coast, Australia
you can view individual POST elements like this:
Code: Select all
print_r($_POST['name']);-
littlemetz85
- Forum Newbie
- Posts: 10
- Joined: Mon Jul 23, 2007 5:23 pm
- iknownothing
- Forum Contributor
- Posts: 337
- Joined: Sun Dec 17, 2006 11:53 pm
- Location: Sunshine Coast, Australia
-
littlemetz85
- Forum Newbie
- Posts: 10
- Joined: Mon Jul 23, 2007 5:23 pm
That still didn't work for me. When I use:
print_r($_POST['name']);
If I use the first field on the form all that data from all the fields is printed and when I use the other fields non of the data is printed. I think the problem is that $_POST is creating an array with only one item and that one item is a string of the entire data output and is called by the first name on the form. Any ideas?
print_r($_POST['name']);
If I use the first field on the form all that data from all the fields is printed and when I use the other fields non of the data is printed. I think the problem is that $_POST is creating an array with only one item and that one item is a string of the entire data output and is called by the first name on the form. Any ideas?
- iknownothing
- Forum Contributor
- Posts: 337
- Joined: Sun Dec 17, 2006 11:53 pm
- Location: Sunshine Coast, Australia
do you actually have an elemnet in the form with the name "name". My example required you to put in your own variable.littlemetz85 wrote:That still didn't work for me. When I use:
print_r($_POST['name']);
If I use the first field on the form all that data from all the fields is printed and when I use the other fields non of the data is printed. I think the problem is that $_POST is creating an array with only one item and that one item is a string of the entire data output and is called by the first name on the form. Any ideas?
Eg.
Code: Select all
<input type="text" name="first_name" />
<input type="text" name="last_name" />Code: Select all
$_POST['first_name'];
$_POST['last_name'];-
littlemetz85
- Forum Newbie
- Posts: 10
- Joined: Mon Jul 23, 2007 5:23 pm
- iknownothing
- Forum Contributor
- Posts: 337
- Joined: Sun Dec 17, 2006 11:53 pm
- Location: Sunshine Coast, Australia
-
littlemetz85
- Forum Newbie
- Posts: 10
- Joined: Mon Jul 23, 2007 5:23 pm
Sure,
The pdf is at http://littlemetz85.110mb.com/Application.pdf
and the php script is at http://littlemetz85.110mb.com/ApplicationSubmit.php
and the full file looks like:
I am using a free web server right now but it will be on a corporate server when it is done.
The pdf is at http://littlemetz85.110mb.com/Application.pdf
and the php script is at http://littlemetz85.110mb.com/ApplicationSubmit.php
and the full file looks like:
Code: Select all
<html>
<head>
<title></title>
</head>
<body>
<?php
echo "Name: ";
print_r ($_POST[txtName]);
echo "Address: ";
print_r ($_POST[txtAddress]);
echo "City: ";
print_r ($_POST[txtCity]);
echo "Thank You";
?>
</body>
</html>I am using a free web server right now but it will be on a corporate server when it is done.