kielmaru's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
14 (0.01 per day)
Joined:
31-January 11
Profile Views:
309
Last Active:
User is offline Dec 15 2012 08:46 PM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   kielmaru has not set their status

Posts I've Made

  1. In Topic: Getting two values from one checkbox form

    Posted 15 Dec 2012

    View PostCTphpnwb, on 15 December 2012 - 02:53 PM, said:

    Well, it should be easy. Have you got it, kielmaru?


    Yes. I asked on another site. I did explode inside a foreach and assigned two arrays for the exploded value.
  2. In Topic: Getting two values from one checkbox form

    Posted 15 Dec 2012

    array(2) { [0]=> string(6) "100.00" [1]=> string(1) "3" }

    that shows up when I vardump it. Thats what I want to do. 100.00 is the price. 3 is the procedure number.

    But if I echo $ercharge, its the word "array".
  3. In Topic: Getting two values from one checkbox form

    Posted 15 Dec 2012

    Wait. Turns out I was printing out the $totalofer which used the function array_sum. Thats why its summing up even the procedure number.

    So I print out $ercharge which is the POST variable from er[].

    The output is just "Array". I wasnt expecting it cause its just going to output the numbers. I mean, if the array_sum worked and it outputted the correct sum, why didnt it output the one that wasnt computed yet?
  4. In Topic: Getting two values from one checkbox form

    Posted 15 Dec 2012

    View PostDormilich, on 15 December 2012 - 04:26 AM, said:

    if a variable prints as "Array", you tried to echo an array directly, which would need other functions to do that correctly.

    some more comments.
    - you’ll get an "array expected" error on the foreach should your first isset() return false.
    - you will never know, which procedure’s checkbos was check, because every hidden textfield submits, but only the checked checkboxes (you may use explicit indices to tie them back together).
    - line #18 won’t work correctly if any of the isset()s returned false.


    Disregard those computations. I know how they work thats why they're commented. I just want to get two values first. I tried this:

    	echo '<td><input type="checkbox" name="er[]" value="'.$price.$procedure.'">';
    
    


    It works. It outputs the procedure number. But the problem is, when i select multiple procedures, it adds it up. And it outputs it as continuous numbers. How can I separate it? Explode() doesnt seem to work.

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

kielmaru hasn't added any friends yet.

Comments

kielmaru has no profile comments yet. Why not say hello?