SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Nov 2004
    Location
    hanoi
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help me, I have problem with php and check box form

    Hi all,
    I am new here, I am a newbie to php as well. I am writing a small stuff but got some problems. Can you help me please.

    this is the form page http://www.haivenu-vietnam.com/test_...w_referees.htm , when visitor choose 3 boxes (I will make visitor only can choose 3 boxes only) it will lead to the result page (I make it, infact it's not automatically generated from database)

    and this is the database:

    CREATE TABLE `referees` (
    `id` int(10) unsigned NOT NULL auto_increment,
    `number` int(3) NOT NULL default '0',
    `name` text NOT NULL,
    `telephone` int(11) NOT NULL default '0',
    PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

    --
    -- Dumping data for table `referees`
    --

    INSERT INTO `referees` VALUES (1, 0, 'Thanh Nguyen', 915678976);
    INSERT INTO `referees` VALUES (2, 0, 'Haivenu', 9272917);
    INSERT INTO `referees` VALUES (3, 0, 'Nguyen Tat Thanh', 912853450);
    INSERT INTO `referees` VALUES (4, 0, 'thanh nguyen', 34683402);
    And this is the process file:
    PHP Code:
    <?php
    $link 
    mysql_connect('localhost''xxxxx''ixxxxx');
     
    mysql_select_db('haivenu_xxxx')      or die(mysql_error().' : '.mysql_error());
    if (!
    $link) {
       die(
    'Could not connect: ' mysql_error());
       
    }

    //query details table begins SELECT * FROM articles $query = "select * from visitors WHERE Name like `%$search%`";
    //for($i=0;$i<=20;$i++)if(isset($_POST["number"][$i])) 
    $query mysql_query("select * from referees where number=".$_POST["number"]." ");

    //$query = mysql_query("select number from referees order by id DESC LIMIT 10");
    while ($row = @mysql_fetch_array($query)) 

    $variable1=$row["number"];
    $variable2=$row["name"]; 
    $variable3=$row["telephone"]; 
    //table layout for results 


    print ("$variable1</br>"); 
    print (
    "$variable2</br>"); 
    print (
    "$variable3</br>"); 
    }
    mysql_close($link);
    ?>
    Can you please check the process file and the form file and if you don't mind please post you solution here.

    I highly appreciate your help, indeed.
    Thanks in advance.

    Thanh Nguyen

  2. #2
    SitePoint Member
    Join Date
    Nov 2004
    Location
    hanoi
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    for more references if you don't mind please have a look at this link: http://www.phpfreaks.com/forums/inde...5&#entry363245

  3. #3
    SitePoint Member
    Join Date
    Nov 2004
    Location
    hanoi
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oops, this forum is busy with new posts but it seems quite with helpers ..

  4. #4
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by tatthanh
    oops, this forum is busy with new posts but it seems quite with helpers ..
    Replying to your own thread knocks it off the "Unanswered Topics" search. First problem.. make the checkboxes an array or give them different names. The way it is now, you can only get one value back for $_POST['number'].


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
  •