Results 1 to 8 of 8
  1. #1

    Default sa maka tabang lng.. PHP


    kung kinsa mn sa inyo dre ang master og PHP tabang lng..hehehe
    dre nlng ko ng post ane kay pra kapwa bisdak rasd ang mag tudlo nko..
    mao ni ang problema ay: naa koy set of radio buttons na gi populate ang value gkan sa mysql database,
    ako gi append ang $quesId sa kada name sa radio buttons para unique ang tag-sa tag-sa ka radio buttons.
    karon di ko kamao pag kuha sa value sa radio button na selected kay ako mn gi ing-ane pag kuha ay:
    <input type = 'radio' name=q$quesId value = \'$a\'>
    $choices = $_GET['q$quesId'];
    echo $choices;
    unsa kahay sakto na paagi pag kuha sa name sa radio button na naay gi append na variable sah? tabang!
    paki check lng sa code...

    <?php
    echo '<form method="post" action="#">
    <table align = "center" border = "1" width = "75%">';
    if($_GET['start']){
    while($row = mysql_fetch_assoc($result)){
    $a = $row['a'];
    $b = $row['b'];
    $c = $row['c'];
    $d = $row['d'];
    $ques = $row['ques'];
    $quesId = $row['quesId'];
    echo"
    <tr>
    <td align = 'left'><b>$ques</b></td>
    </tr>
    <tr>";
    echo" <td align = 'left'>
    <input type = 'radio' name=q$quesId value = \'$a\'>$a
    </td>
    </tr>";
    echo" <tr>
    <td align = 'left'>
    <input type = 'radio' name=q$quesId value = \'$b\'>$b
    </td>
    </tr>";
    echo " <tr>
    <td align = 'left'>
    <input type = 'radio' name=q$quesId value = \'$c\'>$c
    </td>
    </tr>";
    echo" <tr>
    <td align = 'left'>
    <input type = 'radio' name=q$quesId value = \'$d\'>$d
    </td>
    </tr>";
    }
    }
    echo "
    <tr>
    <td align='center'><input type='submit' name='sub' value='Finish'></td>
    </tr>
    </table>
    </form>";
    if($_GET['sub']){
    echo 'ok';
    $choices = $_GET['q$quesId'];// mao ni dre ang pangutana nko.. unsaon nko pag kuha sa name sa akong radio button?
    echo $choices;

    }
    ?>

  2. #2

    Default Re: sa maka tabang lng.. PHP

    sowayi daw

    $choices =$_REQUEST['q'.$questId];
    or
    $choices =$_POST['q'.$questId];

    nag libog ko onsay naka lahi anng get og post. eheheh.
    nya kong di gali ma dala.

    suwayi og var_dump($_GET); para ma kita nimo ang mga keys


  3. #3

    Default Re: sa maka tabang lng.. PHP

    Quote Originally Posted by silent-kill
    sowayi daw

    $choices =$_REQUEST['q'.$questId];
    or
    $choices =$_POST['q'.$questId];

    nag libog ko onsay naka lahi anng get og post. eheheh.
    nya kong di gali ma dala.

    suwayi og var_dump($_GET); para ma kita nimo ang mga keys

    I did this $choices =$_POST['q'.$questId]; pro wala mn ghapon.
    ang kalai-nan sa post og get kay ang variable makita nmo sa url kng get ang gamiton, sa post kay dili

    kanang var_dump($_GET); unsaon pag gamit ana?

  4. #4

    Default Re: sa maka tabang lng.. PHP

    The method on the <form> is POST.
    After submit, ang resulting variables will be in $_POST&#91;] and not in $_GET&#91;].

    Some advice:
    -Put {} brackets on your embedded variables inside a double quote string. This reduces PHP misinterpretation.
    -Enclose the name field value with quotes. Maybe this is your problem.
    For example:
    Code:
    echo "<input type = 'radio' name='q{$quesId}' value = '{$c}'>{$c}";
    Also, as silent-kill pointed use: $choices =$_POST['q'.$questId];
    or $_POST["q{$questId}"]

    Take note also that variables cannot be embedded on strings enclosed with single quotes (') .

    Can you also put: print_r($_POST) and post here the result. We could help you better if we have the info.

  5. #5

    Default Re: sa maka tabang lng.. PHP

    Quote Originally Posted by cold_fusion
    The method on the <form> is POST.
    After submit, ang resulting variables will be in $_POST&#91;] and not in $_GET&#91;].

    Some advice:
    -Put {} brackets on your embedded variables inside a double quote string. This reduces PHP misinterpretation.
    -Enclose the name field value with quotes. Maybe this is your problem.
    For example:
    Code:
    echo "<input type = 'radio' name='q{$quesId}' value = '{$c}'>{$c}";
    Also, as silent-kill pointed use: $choices =$_POST['q'.$questId];
    or $_POST["q{$questId}"]

    Take note also that variables cannot be embedded on strings enclosed with single quotes (') .

    Can you also put: print_r($_POST) and post here the result. We could help you better if we have the info.
    woooow! wla ko kbantay dah! nag karambola mn diay ang get og post nko.. anyway, na correct na nko, "get" og $_GET&#91;] na ang gami nko.
    gi try nasd ni nko echo "<input type = 'radio' name='q{$quesId}' value = '{$c}'>{$c}";
    og gi try nsd ni nko $_GET["q{$questId}"]
    still no luck. gi suwayan sa nko na kausa lang sa mo loop pra osa rasd ka set sa radio button ang kuhaan og value pro wala mn ghapon.. mao nani ang bag-o na code.

    <?php
    echo '<form method="get" action="#">
    <table align = "center" border = "1" width = "75%">';
    if($_GET['start']){
    while($row = mysql_fetch_assoc($result)){
    $a = $row['a'];
    $b = $row['b'];
    $c = $row['c'];
    $d = $row['d'];
    $ques = $row['ques'];
    $quesId = $row['quesId'];
    echo"
    <tr>
    <td align = 'left'><b>$ques</b></td>
    </tr>
    <tr>";
    echo" <td align = 'left'>
    <input type = 'radio' name='q{$quesId}' value = '{'$a}'>{$a}
    </td>
    </tr>";
    echo" <tr>
    <td align = 'left'>
    <input type = 'radio' name='q{$quesId}' value = '{$b}'>{$b}
    </td>
    </tr>";
    echo " <tr>
    <td align = 'left'>
    <input type = 'radio' name='q{$quesId}' value = '{$c}'>{$c}
    </td>
    </tr>";
    echo" <tr>
    <td align = 'left'>
    <input type = 'radio' name='q{$quesId}' value = '{$d}'>{$d}
    </td>
    </tr>";
    }
    }
    echo "
    <tr>
    <td align='center'><input type='submit' name='sub' value='Finish'></td>
    </tr>
    </table>";

    if($_GET['sub']){
    echo 'ok';
    print_r($_GET["q{$quesId}"]);
    }
    ?>
    </form>

  6. #6

    Default Re: sa maka tabang lng.. PHP

    gi suwayan nimo og var_dump?. para ma kita nimo tanan sud sa imong $_GET nga array?.
    gamit ni siya para ma kita nimo ang sud sa imong array. para pud maka hibaw ka sa mga keys.

    Code:
    <?php
      echo '<pre>'. var_dump($_GET).'</pre>'; 
    
      echo '<form method="get" action="#">
       <table align = "center" border = "1" width = "75%">';
      if($_GET['start']){
       while($row = mysql_fetch_assoc($result)){
    ...
    ...
    ...
    ?>

  7. #7

    Default Re: sa maka tabang lng.. PHP

    Quote Originally Posted by romano2717
    still no luck. gi suwayan sa nko na kausa lang sa mo loop pra osa rasd ka set sa radio button ang kuhaan og value pro wala mn ghapon.. mao nani
    Ok. But remember also that $_GET variables only be filled up AFTER you click SUBMIT.
    The first open of the page will not show your variable. It is only after submission.

    Try var_dump or print_r . And post here the results.

  8. #8

    Default Re: sa maka tabang lng.. PHP

    If para dili ka maglibog you can use $_REQUEST['variable'] sinc $_REQUEST is used for both..... Aside from that i do suggest to used the post method in order for the security purposes... if you are getting problem catching th submit name you can still used the $_POST method.


    Other thing if you are trying to output an array a any method or an array you can used this stuff

    echo "<xmp>";
    print_r($_POST); // or any arrays to put into it..
    echo"</xmp>";


    I pretty much sure you will see the the data more organized to look at this is very useful for catching datas.. hope it helps

  9.    Advertisement

Similar Threads

 
  1. For Sale: kinsa dinhi ganahan maka save sa gasolina?maka tabang pud sa imong health?
    By jheadz in forum Everything Else...
    Replies: 88
    Last Post: 07-26-2012, 09:36 PM
  2. asa ta mo apil grupo maka tabang sa environment?
    By Jin21 in forum Hobbies & Crafts
    Replies: 3
    Last Post: 04-10-2012, 06:07 PM
  3. For Sale: Sa maka una lng!! Lp 6.5" female
    By Trunkz "The Pitbull" A. in forum Pets
    Replies: 4
    Last Post: 08-17-2011, 01:04 PM
  4. For Sale: N95-8GB (w/ actual pics) @ 7K SA MAKA-UNA LNG!SWERTE MAKAPALIT!RUSH!!
    By xhunley in forum Cellphones & Accessories
    Replies: 8
    Last Post: 09-20-2010, 03:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top