This forum is no longer open and is for reading/searching only.
Please use our new MachForm Community Forum instead.
MachForm Community Forums » MachForm 2
Allow posting of data using GET/POST
Started 15 years ago by browncom | 15 posts |
-
Hello,
How can I allow a vendor to send data to my webform using HTTP POST or GET? Also, is there another way of turning off this feature other than using Captcha?
Great script and great support!!!
Posted 15 years ago # -
Not sure I understand the question. Do you want *your* form on someone else's website?
IN that case, just use the embed code (the Iframe method) to place your form on a third party's site; that's the method that is generally used anyway.....
Posted 15 years ago # -
No. I want a partner who has data to just post that data to my form. Usually someone can post data to a web form URL as follow:
http://www.mydomain.com/machform/view.php?id=3&element_1=someemailaddress@gmail.com
Posted 15 years ago # -
Still not understanding you. To post data in the form, that person would need to see the form on a web page (i.e. embedded in a page using the "embed" options available), so as I said above, give the the person the URL to the form.
Otherwise, someone else will need to chime in to this thread because I can't understand exactly what you're asking - I believe I've answered the question as I understand it.
Not sure where you're going with the email address appended....but it won't really work, the person would have to enter the details in each field of the form and click "submit" as is usual with such forms.
I don't know how this relates back to your original point about "Get" and "Post" either.
Sorry I can't help more.
Posted 15 years ago # -
Here is an overview of how forms work: http://en.kioskea.net/contents/html/htmlform.php3
See the section called "Sending Data". It looks like I may need to use the GET method as described to send data to my webform but can't figure out how to do it using Machform's script.
In the sample URL I posted it is showing how you would typically send a single data field to a form in the URL.(email address in this case)
I would imagine that this is possible because that is the reason the Captcha feature is available. It prevents people from sending data to your form via a URL in an automated fashion.
Any assistance is appreciated.
Posted 15 years ago # -
Hmm.. MachForm uses POST to accept form data. So you should use POST method to send the data.
The easiest way to do this would be using HttpClient class.
Check this:
http://scripts.incutio.com/httpclient/Using that class, you can send data easily to *any* form, including MachForm.
Some sample from their page:$pageContents = HttpClient::quickPost('http://example.com/someForm', array( 'name' => 'Some Name', 'email' => 'email@example.com' ));
very simple and easy, just change the address above with your form URL and the values with your own values.
MachForm Founder
Posted 15 years ago # -
Did you ever get this figured out? I too would like to be able to send data to the db without the use of the form. I've tried a few different methods:
viewform.php?id=1&element1_1=John
machform.php?id=1&element1_1=JohnAny ideas? Thanks.
Posted 15 years ago # -
duetwo -- that is a different case.
For that purpose, check this post:
http://www.appnitro.com/forums/topic/dynamic-content-php?replies=12#post-304MachForm Founder
Posted 15 years ago # -
Guys, you should NEVER use GET to store form data.
GET is used for queries that have no permanent effect on the server (like a search query). POST is used for queries that DO have a permanent effect on the server (like data input).
Why is this important? Because of proxy servers. Proxy servers are allowed to decide if they pass on a GET request, or even repeat it. So if the client does a GET request, the server might receive it 0, 1, 2 or even 10 times. A POST request will always be sent once and exactly once.
Posted 15 years ago # -
Hi Yuniar,
Actually, I've seen that post before, but that only deals with pre-populating a field.
What I'm trying to do should be rather simple.
I'm using one installation of machform on one server and I have multiple sites. The other sites are just using standard forms (not machform). I'm just trying to figure out how to post data to the database without filling out the form.
For example, on my other databases, I simply post data to them by doing something like:
form.php?FirstName=John&LastName=Smith&Email=johnsmith@aol.com&etc..
I'm pretty sure there is a way to post to machform without submitting the form?
viewform.php?id=1&element1_1=John&element_1_2=Smith&element_2_1=johnsmith@aol.com&etc..
Hopefully, this makes sense?
Posted 15 years ago # -
In summary, I'm trying to figure out how to post to the machform database without filling out the form.
Posted 15 years ago # -
Ah.. I see.
Passing the data through the URL as query parameters won't work.
MachForm only accept form data as POST not GET.As my post above, you can use HttpClient class, download it from here:
http://scripts.incutio.com/httpclient/Using that class, you can send data easily to *any* form, including MachForm.
Let say you have a form with id = 5 and few fields on it, your code would be:$pageContents = HttpClient::quickPost('http://example.com/machform/view.php', array( 'form_id' => '5', 'element_1' => 'Some text here', 'element_2' => 'Some text here', 'element_3' => 'Some text here', ));
As simple as that. Check their tutorial and documentation for more info.
MachForm Founder
Posted 15 years ago # -
First let me say, thank you for great tool with reasonable price. Also great support. Seems like every post has been replied. I never seen such great support before.
I am very beginner with php and not sure how httpclient will work as you said.
What i am trying to do is, i have simple login system and it will pass $_session[username] which contain UserName, and I want to pass that username value to post it when form is submitted, so I will know which user submit the form.
would be appreciate if you could help this. Thankx
Posted 15 years ago # -
monaye -- this one is pretty simple and won't need the above HttpClient.
First of all, you need to add a 'Single Line Text' field to your form, give it a label "username" or something.
Then view the HTML source of your form and see the id for your "username" field. Let say you have "element_2" as the id and your form itself is having id number 7.
Now edit your includes/view-functions.php file, search around line 34 for this code:
//check for populated value, if exist, use it instead default_value if(isset($element->populated_value['element_'.$element->id]['default_value'])){ $element->default_value = $element->populated_value['element_'.$element->id]['default_value']; }
Right under that block of code, add this code:
if(($_REQUEST['id'] == 7) && ($element->id == 2)){ $element->default_value = $_SESSION['username']; }
That should set the default value for that username field with your session variable.
Then to make this field hidden on your form, edit your form CSS and add this code:
#li_2{ display: none !important; }
and you are all set.
If you are having difficulty, please mail to: customer.service [at] appnitro.com
Send me the URL to your form (make sure you have the "username" field added) and I'll help you directly.MachForm Founder
Posted 15 years ago # -
how do you do this with an embedded iframe? Your host page must be php?
Also, is it possible to detect if a field value is set via this get method / passing of a parameter and if so readonly / disable the field?Posted 12 years ago #
Reply
You must log in to post.