Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7922195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:52:19+00:00 2026-06-03T16:52:19+00:00

I have a form with over 100 dynamically named fields, that post to a

  • 0

I have a form with over 100 dynamically named fields, that post to a php file, I want to take all the fields that are posted to the php file which is currently:

Array ( [option_page] => plugin_options 
[action] => update 
[_wpnonce] => a51bfc281a 
[_wp_http_referer] =>/wp-admin/options-general.php page=plug.php 
[13939069] => 
[2171] => 
[3600645] =>
[2168] => 
[13937024] => 
[submit] => Save Changes 
[__qca] => P0-1887521465-1334258158937 
[s_vi] => )

From this I want to insert the data into a mysql table in the format:

id      | option_name     | value
--------------------------------------------
autonum | post data key   | post data value

But the issue is I am only intrested in the post data value after: [_wp_http_referer]
but before [submit] so these can be used as reference points.

The part I am stuggling with is:

  • how would I get only that part of the post data dynamically?
  • How would I get the required array keys and insert it into the
    table dynamically?

Many thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T16:52:20+00:00Added an answer on June 3, 2026 at 4:52 pm

    You mat try this

    $start = array_search("_wp_http_referer",array_keys($_POST))+1;
    $end = array_search("submit",array_keys($_POST))-1;
    $newArr=array_slice($_POST, $start, $end);
    foreach($newArr as $k=>$v)
    {
        // $k is the key name and $v is the value of that key
        //echo $k."=".$v."<br />";  
        $val=mysql_real_escape_string($v);
        $sql="INSERT INTO table_name VALUES (null, ".$k.", ".$val.")";
        mysql_query($sql);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form with over 100 list items that I must reorder on
I have a form which has over 100 fields (most of which are checkboxes)
I have a small form with a control that I want to position over
I have a Windows form application that's consuming web services over https and is
A form I don't have any control over is POSTing data to my PHP
I'm trying to build a PHP form that outputs custom JSON code. Take a
I have quite a big form with multiple (over 100) submit buttons in it.
I have a unique situation over here. I have a button on a form
I have form with few buttons and I want to know what button is
I have form, where some fields are looks like rows, so I can add/delete

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.