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"];

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.