Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How can I avoid GET and force POST method in PHP?

Featured Replies

Hello PHP Ninjas,

I have a multipart form that needs to post to multiple FM7 tables via FX.php. Is it possible to force the POST method in PHP across all the pages? Here's the dealio:

Step 1: foo.php - Form action goes to foo-add.php

Step 2: foo-add.php - retrieves data via POST, submits to foo table in FM7, then redirects to bar.php?foo=123 via an html meta tag.

Step 3: bar.php - retrieves foo via GET, builds new form where foo is a hidden field. Form action goes to bar-add.php.

Step 4: bar-add.php - retrieves data via POST, submits to bar table in FM7, then redirects to success page.

For the sake of security, cleaner error trapping and stronger data entry integrity, I don't want to rely on data getting passed by GET from step 2 to 3. A user could simply change the data in the URL or a hacker might try to write their own script to access data via GET. I have to write considerably more PHP logic to prevent these scenarios.

How can I pass all variables via POST method in PHP/HTML without inserting a success step between Step 2 and 3? Your thoughts are greatly appreciated!

Shannon

-=-=-

I've used "curl" in php to POST a Form. For example:

<?php

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://localhost:1154/FMPro");

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, "-db=combotest.fp5&-format=-fmp_xml&-findall");

curl_exec($ch);

curl_close($ch);

?>

Good Luck.

Garry

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.