SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru arunkumar's Avatar
    Join Date
    Jan 2005
    Location
    India:Chennai
    Posts
    827
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to submit a checkbox array when clicking hyper link

    I am having a chech box array in a form

    as

    <form name="blah" action="some.php" method="post">
    <input type = "checlbox" name="as[]" value="1">
    <input type = "checlbox" name="as[]" value="2">
    <input type = "checlbox" name="as[]" value="3">
    <input type = "checlbox" name="as[]" value="4">
    <input type = "submit" name="clk" value="click">
    </form>

    this is my form and a having a href.. below it like

    <a href="samepage.php"> Page1 </a>

    when i check the check box values and click the page the check box value should be passed how can i do it...

    Any suggestion...................
    Where there is a will there is a way
    ArunKumar

  2. #2
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    The values will be passed as an array by the post data. You can get at the array by

    $array = $_POST['as'];
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  3. #3
    SitePoint Guru arunkumar's Avatar
    Join Date
    Jan 2005
    Location
    India:Chennai
    Posts
    827
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No it is passing when i use a submit button but not passing when i use a hyperlink
    Where there is a will there is a way
    ArunKumar

  4. #4
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by arunkumar
    No it is passing when i use a submit button but not passing when i use a hyperlink
    Oh, now I see what youre asking, well I think the only way youre going to do that is by using javascript. Use the onClick function of the href to read the state of the checkboxes and append those to the url, you can then retrieve them through PHP $_GET.

    Just an afterthought, why have you got a submit button in your form if your not going to use it ?
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming


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
  •