Results 1 to 9 of 9

Thread: PHP help me

  1. #1

    Default PHP help me


    mga bro patabang ko sa php

    naa koy gihimu na murag survey2 bah nya naay choices kada question

    example
    1. what would you do if your friend is in trouble
    a.)help
    b.)run
    c.)kill

    2. if u had power...
    a.)destruction
    b.)healing
    c.)windwalk

    etc..

    if good answers iyang i select, naa koy good and evil counter nga mu increment
    then finally mu determine dayun siya if good or evil.
    ing.ana gud..pwede ba na sa php?

  2. #2

    Default Re: PHP help me

    Of course pwede... =)

  3. #3

    Default Re: PHP help me

    pwede example?

  4. #4

    Default Re: PHP help me

    Just write the code and I'll help you debug it. =)

    [ simon.cpu ]

  5. #5

    Default Re: PHP help me

    <html>
    <body>
    <?php
    $good=0, $evil=0, $neu=0;


    switch($_POST["ans1"])
    {
    case "help": $good++; break;
    case "tele": $good++; break;
    case "run": $neu++; break;
    case "kill": $evil++; break;
    default: break;
    }
    switch($_POST["ans2"])
    {
    case 1: $evil++; break;
    case 2: $good++; break;
    case 3: $neu++; break;
    case 4: $neu++; break;
    }
    switch($_POST["ans3"])
    {
    case "Bad": $evil++; break;
    case "Good": $good++; break;
    }

    if($good > $evil && $good > $neu)
    echo "You can save humanity!";
    else if($evil > $good && $evil > $neu)
    echo "You are evil.Bring destruction to the world"
    else echo "You are playing safe, LOSER!"


    if($good == 1)
    echo "Good";
    if($evil == 1)
    echo "Evil";
    if($neu == 1)
    echo "Yey";
    ?>

    </body>
    </html>
    that's my PHP script


    for the HTML, it would be something like
    <form action="answer.php" method="post">

    Question 1:
    <input type="radio" name="ans1" value="help">
    <input type="radio" name="ans1" value="tele">
    <input type="radio" name="ans1" value="run">
    <input type="radio" name="ans1" value="kill">

    Question 2:
    <input type="radio" name="ans2" value="1">
    <input type="radio" name="ans2" value="2">
    <input type="radio" name="ans2" value="3">
    <input type="radio" name="ans2" value="4">

    Question 3:
    <input type="radio" name="ans3" value="bad">
    <input type="radio" name="ans3" value="good">

    <input type="submit" name="Go">
    </form>

  6. #6

    Default Re: PHP help me

    suggestion na simang:

    if u dont need to make db processes, pwede rman siguro js ana bai. i think.

  7. #7

    Default Re: PHP help me

    d man au ko kbw java gd baiii....huhuhuh.....duda jud nako pwede man jud ni ba

  8. #8

    Default Re: PHP help me

    i hate Java too. so much.

    pero JS is close to C. atleast the processing is done on the client's side and will not put any load on your server.

  9. #9

    Default Re: PHP help me

    poymode,

    If you want to create a similar script that needs 2 or more pages, you might want to explore sessions (http://www.php.net/manual/en/ref.session.php). Sessions let you preserve data across multiple pages. A database would also be helpful, especially if you want your script to scale to hundreds or thousands of questions. Doing it manually is tedious.

    [ simon.cpu ]

  10.    Advertisement

Similar Threads

 
  1. Im learning PHP, Help me hw to run the PHP!
    By kyme in forum Programming
    Replies: 23
    Last Post: 08-21-2012, 02:57 AM
  2. help me..!!!
    By hot_chick in forum "Love is..."
    Replies: 53
    Last Post: 07-13-2011, 03:21 PM
  3. help me in php, am a newbie
    By maue in forum Programming
    Replies: 21
    Last Post: 06-15-2009, 10:37 AM
  4. could anyone help me with php and javascripts
    By isaac42 in forum Programming
    Replies: 6
    Last Post: 05-07-2009, 02:24 PM
  5. Help Me I Cant Log In
    By mark eugene in forum Support Center
    Replies: 12
    Last Post: 06-06-2005, 02:35 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