Jump to content

foreach on a sequence of $_POST or $_GET variables


turpentyne

Recommended Posts

I have a php search page that takes form data to create its queries, then reload the original search page. The form is long, so there are numerous $_POST's to convert to variables for use in the query. I've looked at "extract" and a few other code snippets. But it's a form and I don't want any security issues. I'm hoping there's a "foreach" solution, but I'm a beginner. What's a proper way to to simplify this:

 

$s1 = $_POST["s1"];

$s2 = $_POST["s2"];

$s3 = $_POST["s3"];

$s4 = $_POST["s4"];

$s5 = $_POST["s5"];

$s6 = $_POST["s6"];

$s7 = $_POST["s7"];

$s8 = $_POST["s8"];

$s9 = $_POST["s9"];

$s10 = $_POST["s10"];

$s11 = $_POST["s11"];

$s12 = $_POST["s12"];

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.