Results 1 to 2 of 2

Thread: Creating a PHP arrays in a HTML form

  1. #1
    OMF Member
    Join Date
    Apr 2015
    Posts
    35
    Thanks
    3
    Thanked 3 Times in 3 Posts

    Post Creating a PHP arrays in a HTML form

    To get your FORM result sent as an exhibit to your PHP script you name the INPUT, SELECT, TEXTAREA components like this:

    <input name=”MyArray[]“>
    <input name=”MyArray[]”>
    <input name=”MyArray[]”>
    <input name=”MyArray[]”>

    In the event that you don't indicate the keys, the array gets dispatched in the request the components show up in the structure. Above illustration will contain keys 0, 1, 2 and 3. Notice the square sections after the variable name, that is the thing that makes it aa array. You can amass the components into diverse clusters by relegating the same name to distinctive components:

    <input name=”MyArray[]“>
    <input name=”MyArray[]”>
    <input name=”MyOtherArray[]“>
    <input name=”MyOtherArray[]”>

    This delivers two arrays, MyArray and MyOtherArray, that gets sent to the PHP script. It's additionally conceivable to assign particular keys to your arrays:

    <input name=”AnotherArray[]”>
    <input name=”AnotherArray[]”>
    <input name=”AnotherArray[email]“>
    <input name=”AnotherArray[phone]”>

    The AnotherArray array will now contain the keys 0, 1, email and phone.

  2. #2
    Respected Member ADMIN's Avatar
    Join Date
    Mar 2013
    Posts
    702
    Blog Entries
    1
    Thanks
    63
    Thanked 43 Times in 35 Posts

    Re: Creating a PHP arrays in a HTML form



    Quote Originally Posted by rakib1279001 View Post
    To get your FORM result sent as an exhibit to your PHP script you name the INPUT, SELECT, TEXTAREA components like this:

    <input name=”MyArray[]“>
    <input name=”MyArray[]”>
    <input name=”MyArray[]”>
    <input name=”MyArray[]”>

    In the event that you don't indicate the keys, the array gets dispatched in the request the components show up in the structure. Above illustration will contain keys 0, 1, 2 and 3. Notice the square sections after the variable name, that is the thing that makes it aa array. You can amass the components into diverse clusters by relegating the same name to distinctive components:

    <input name=”MyArray[]“>
    <input name=”MyArray[]”>
    <input name=”MyOtherArray[]“>
    <input name=”MyOtherArray[]”>

    This delivers two arrays, MyArray and MyOtherArray, that gets sent to the PHP script. It's additionally conceivable to assign particular keys to your arrays:

    <input name=”AnotherArray[]”>
    <input name=”AnotherArray[]”>
    <input name=”AnotherArray[email]“>
    <input name=”AnotherArray[phone]”>

    The AnotherArray array will now contain the keys 0, 1, email and phone.

    sweet! clearly you know your stuff!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •