Jump to content

phpnb

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

phpnb's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. hi everyone, am new here, new to php as well have a question as i am baffled. i have been on this for a while but still searching for an answer. heres the logic im getting user input through a text box and storing it in a variable im searching through a text file for a match and displaying the output. The text file holds data about cars. if the user enters lets say model then it should display the make, model, price, year, viewed values. i have got it to store the values in array form. <html> <head> <title> Maximum Price  </title> </head> <BODY bgcolor=white vlink=white> <FORM NAME=myForm METHOD="POST" > Maximum Price <INPUT SIZE =12 TYPE="text" name="Numb1"> <INPUT TYPE="SUBMIT" VALUE="Process"> <p> <? $filename = "cars.txt"; $fd = fopen ($filename, "r"); $contents = fread ($fd,filesize ($filename)); fclose ($fd); $splitcontents = explode(",", $contents); #The following part stores make, model, price, year, viewed in array form, eg table[0], table[1] #table[0] holds 1 record, table[1] holds another record and so on ############## $check=0; $nc=9; for ($count=5; $count<count($splitcontents); $count++) {         $table[$check][]=$splitcontents[$count];         if ($count==$nc){         $nc+=5;         $check+=1;         } } ############################################## $val = $_POST['Numb1']; ## as an example i was trying to display value from table[0] only but even that didnt work for ($count=0; $count<count($table[0]); $count++){         if($val==$table[0][$count]){                                  #if the value returned matches with                 for ($nc=0; $nc<count($table[0]); $nc++){      #any value from table[0] then print out the                 print $table[0][$nc];                                      #the whole table                 }         } } ########### really need help guys will wait for positive replies. thanks all
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.