www.webdeveloper.com
Results 1 to 2 of 2

Thread: Help Me

  1. #1
    Join Date
    Sep 2013
    Posts
    18

    Help Me

    Hi,

    i have a task i.e

    <form action="" method="post">
    Sort by: asc<input type="radio" name="result"value="asc" />
    desc<input type="radio" name="result" value="desc" />
    Enter String: <textarea cols="40" rows="5" name="myname"> </textarea>
    <input type="submit" name="submit" value="submit" />
    </form>


    this is a form...

    when i am enter some values like: apple, banana, cat,rat,mouse

    the output will comes either ascending order nor descending order according to that radio button selections..

    please help me..

  2. #2
    Join Date
    Feb 2012
    Location
    Tallahassee, FL
    Posts
    280
    This feels like homework.

    PHP Code:
    if(isset($_POST['submit'])){
        
    $sortType $_POST['result'];
        
    $words explode(",",$_POST['myname']);
        if(
    $sortType == "asc"){
            
    sort($words);
        }elseif(
    $sortType == "desc"){
            
    rsort($words);
        }else{
            
    //Bad sorting type
        
    }
        
    //Now do something with $words.
        


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles