SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Oct 2008
    Location
    Mardan
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Select list menu outputs array.

    Hi again.

    I am trying to make user select a job from a drop down list which I can catch in $_POST and insert into db. However when I echo out the select menu it tells me its an Array.
    Here is the HTML

    HTML Code:
    <select name="job_title" id="job_title">
                <option value="Gender Specialist">Gender Specialist</option>
                <option value="Master Trainer" selected="selected">Master Trainer</option>
              </select>
    PHP Code:
    <? php echo $_POST['job_title']; ?>
    It outputs an Array.

    Thank You very much.

  2. #2
    SitePoint Addict bronze trophy vectorialpx's Avatar
    Join Date
    Dec 2012
    Location
    Bucharest
    Posts
    247
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    The POST will only return an array if the name is "job_title[]". In your case, should not happen.
    Try var_dump($_POST); and check how it looks like.
    Maybe the POST value is rewrote somewhere upper into your code.
    Be nice to nerds. Chances are you'll end up working for one - Bill Gates
    > photos | admin panel

  3. #3
    SitePoint Member
    Join Date
    Oct 2008
    Location
    Mardan
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes it was getting duplicated. Thanks.


Bookmarks

Posting Permissions

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