0

Dear Friends,
I am a web designer hence i only know very little of PHP programming. I need help on the PHP script for me to post data from other server to my server.

Due to my lack of knowledge in PHP so i'm using JetForm.com as a third party for me to install a subscription script. So i created a form from JetForm and copy the script to my website but unfortunately all the data will be kept at JetForm server and not mine.

Basically i need to pull the data to my server because i have a login function and they suggested me to use the post data feature so that after the customer click the submit form button, all the data will be post to my own server.

Can anyone assist me with the post data script? So that i can receive the customer information to my database.

I already have a very simple login script but i need the customer data so that they can login. I also created a database table in MySQL as per below:

CREATE TABLE `users` (
`id` int(11) NOT NULL auto_increment,
`username` varchar(50) NOT NULL default '',
`password` varchar(150) NOT NULL default '',
`password_hint` varchar(255) NOT NULL default '',
`lastname` varchar(50) NOT NULL default '',
`firstname` varchar(50) NOT NULL default '',
`email` varchar(100) NOT NULL default '',
`phone` varchar(50) NOT NULL default '',
`address1` varchar(100) NOT NULL default '',
`address2` varchar(100) NOT NULL default '',
`city` varchar(80) NOT NULL default '',
`state` varchar(20) NOT NULL default '',
`zip` varchar(20) NOT NULL default '',
`country` varchar(50) NOT NULL default '',
`url` varchar(125) NOT NULL default '',
`permissions` varchar(20) NOT NULL default '1',
PRIMARY KEY (`id`)
)


Please help me.

Thanks in advance.

Edit:
by the way the people in JotForm suggested me to add in <? print_r($_POST); ?> to the script so that the data will go to my database. But where and how to add in the script.

Regards.

Edited by Melanie22: n/a

3
Contributors
13
Replies
15
Views
6 Years
Discussion Span
Last Post by grayceworks
0

Thanks xylude, btw is that the tut for 'post' from other server to my database?
Will go through it now... :)

xoxo

0

As long as the script doing the posting is on your server, you should be able to first direct it to your script. After that if you need to send it to theirs, it's fairly easy to find a tutorial on curl to do just that.

0

xylude,

I have checked the tut but i am totally blur...
So i need to create a new .php in order for the data to 'post' to my database based on my table that i created?

Below sample from the tut:

<form action="process.php" method="post">
<select name="item">
...
<input name="quantity" type="text" />

***********************************
My Question:

So where should i put the <? print_r($_POST); ?>
so that i can activate the post feature in JetForm.com?
How i want to write it so that it will fit all the table that i created?

Regards.

0

I have check with the JetForm programmer, they replied me:

"Send Post Data" is a feature that allows you to post form data to your Thank You page.

Some Use Cases:
- If you would like to save the form posts on your web site using your own server side script.
- If you would like to use the form data posted on your Thank You page.

To see how it works:
1. Create a "test.php" on your site and put this code in it:
<? print_r($_POST); ?>
2. Go to "Setup & Share" -> "Thank You" -> "Custom URL" and enter http://domain.com/test.php
3. Enable the "Send Post Data"
4. Save and submit your form.

***************************************************

But how to do this?

Regards

0

Any way I can get a link to the site you got your form from? I can look it over and probably give you some better advice.

0

Woww...thunbs up to you and TQ very much..appreciate it a lot!

The form i get it from:
http://www.jotform.com

The guide for 'post':
http://www.jotform.com/help/51-How-to-Post-Submission-Data-to-Thank-You-Page

Basically they have the "Send Post Data feature". Once the form is completed the user will be redirected to my site with the data entered on the form. I can then get the data from $_POST on PHP and save it on my own database.

The table that i created:

CREATE TABLE `users` (
`id` int(11) NOT NULL auto_increment,
`username` varchar(50) NOT NULL default '',
`password` varchar(150) NOT NULL default '',
`password_hint` varchar(255) NOT NULL default '',
`lastname` varchar(50) NOT NULL default '',
`firstname` varchar(50) NOT NULL default '',
`email` varchar(100) NOT NULL default '',
`phone` varchar(50) NOT NULL default '',
`address1` varchar(100) NOT NULL default '',
`address2` varchar(100) NOT NULL default '',
`city` varchar(80) NOT NULL default '',
`state` varchar(20) NOT NULL default '',
`zip` varchar(20) NOT NULL default '',
`country` varchar(50) NOT NULL default '',
`url` varchar(125) NOT NULL default '',
`permissions` varchar(20) NOT NULL default '1',
PRIMARY KEY (`id`)
)

Regards

Edited by Melanie22: n/a

0

Ok, first you need to go to the 'edit form' page and click 'preferences'. Set 'Send Post Data' to 'Yes'.

Next click 'Thank You Page' and set it to a page on your server. Fill out the form with dummy information and it should send you to your thank you page. Then on that page, do the <? print_r($_POST); ?> and copy/paste what it returns to here.

It should return an array of all the data sent via $_POST. From there, you should have all of the post id's so you can assign them to variables; then insert them into your database. I'll help you out with the first bit of code to get you started.

0

Send Post Data set to YES - checked
Set it to custom URL Thank You Page - checked
Create a Thank You Page -checked (i create thankyou.html
Fill up a dummy information in form - checked

But i'm lost here:
Then on that page, do the <? print_r($_POST); ?> and copy/paste what it returns to here.

After fill up the form, it directed me to my thank you page. But how to get the data and keep in my database?

Regards

0

Copy and paste what shows up on the thankyou.php (it needs to be .php extension) to this forum. That is the only way we can find out what was posted to your page.

0

Copy and paste what shows up on the thankyou.php (it needs to be .php extension) to this forum. That is the only way we can find out what was posted to your page.

I am trying to accomplish exactly the same thing: get my data from my thankyou.php page from my jotform and get it into my database.

I have followed the steps so far:

enabled the post data in jotforms

set up the form to go to my thankyou.php page on submit

created the following table in my database:
(I think those would be the correct field names? they are the ones that show in the array, rather than the actual form field id's -- or do I need to use the form field id's ?)

CREATE TABLE `quitform` (
`id` int(11) NOT NULL auto_increment,
`submission_id` int(18) NOT NULL default '',
`formID` varchar(11) NOT NULL default '10362011038',
`ip` varchar(50) NULL default '',
`fullname` varchar(150) NULL default '',
`email5` varchar(255) NULL default '',
`reasons` varchar(255) NULL default '',
`ifother` varchar(255) NULL default '',
`describethe` varchar(255) NULL default '',
`didthese` varchar(50) NULL default '',
`stillneed` varchar(50) NULL default '',
`pleaselet48` varchar(255) NULL default '',
`initials` varchar(10) NULL default '',
PRIMARY KEY (`id`)
)

make the thankyou.php page with the following:

<?php print_r($_POST); 
// need to put these values from the array into the database
?>

Which outputs the following array:

Array ( [submission_id] => 16297146899114xxxx [formID] => 103620xxxxx [ip] => xx.xxx.xxx.xxx [fullname] => grayce [email5] => none@none.com [reasons] => Array ( [0] => Issue with Instructor [1] => Schedule Conflict [2] => Loss of Job [3] => Loss of Interest [4] => Student Not Practicing [5] => Moving Away [6] => Going to College [7] => Taking a Break [8] => Vacation [9] => Customer Service [10] => Other ) [ifother] => more [describethe] => more stuff [didthese] => My issue is resolved! [stillneed] => Array ( [0] => Please Contact Me ) [pleaselet48] => more concerns [initials] => gcw )

Now I'm guessing that I need to assign these to variables or something? And do I need a query or command of some sort to actually insert these into the table? And how will it deal with the [reasons] array which has 10 possible items that go into a single field from the form's checkbox choices?

I've gotten this far, but I don't know if this is right:

$submission_id = $_POST['submission_id'];
$formID = $_POST['formID'];
$ip = $_POST['ip'];
$fullname = $_POST['fullname'];
$email5 = $_POST['email5'];
$reasons = $_POST['reasons'];
$ifother = $_POST['ifother'];
$describethe = $_POST['describethe'];
$didthese = $_POST['didthese'];
$stillneed = $_POST['stillneed'];
$pleaselet48 = $_POST['pleaselet48'];
$initials = $_POST['initials'];

What do I do next to get the values into my table?

1

Yep, you need to use an insert statement to get those into your db.

This should work:

mysql_query("INSERT INTO quitform (submission_id,formID,ip,fullname,email5,reasons,ifother,describethe,didthese,stillneed,pleaselet48,initials) VALUES ('$submission_id','$formID','$ip','$fullname','$email5','$reasons','$ifother','$describethe','$didthese','$stillneed','$pleaselet48','$initials')") or die(mysql_error());
Votes + Comments
Helpful! Thanks!
0

Had to make a couple adjustments to suit the apps I'm working with, but yes, that worked! Thank you so much!

If you have a bit of time, could you contact me regarding another question I have? I appreciate it! Thanks!

Yep, you need to use an insert statement to get those into your db.

This should work:

mysql_query("INSERT INTO quitform (submission_id,formID,ip,fullname,email5,reasons,ifother,describethe,didthese,stillneed,pleaselet48,initials) VALUES ('$submission_id','$formID','$ip','$fullname','$email5','$reasons','$ifother','$describethe','$didthese','$stillneed','$pleaselet48','$initials')") or die(mysql_error());
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.