html - How do I match variables in PHP? -


for class, need create fake online dating site matches people based on variables. singles.txt file contains user's name, gender(m of f), age, personality type, favorite os, seeking genders (m,f or mf) , min/max seeking age, separated commas. code below checkboxes index.php/signup page.

    <input type="checkbox" name="seekmale" value="m"/>male     <input type="checkbox" name="seekfemale" value="f"/>female 

the code below matches.php. can't figure out of seeking gender part work. if new user male seeking females, females seeking males should displayed, etc. appreciated.

    <?php     $name = $_get["name"];//get name parameter     $people = file("singles.txt", file_ignore_new_lines);//load data singles.txt     ?>      <h1>matches <?= $name ?></h1>             <?php      foreach($people $person) {         list($person_name, $gender, $age, $type, $os, $min, $max) = explode(",", $person);         if($person_name == $name) {             foreach($people $match) {                 list($match_name, $match_gender, $match_age, $match_type,              $match_os, $match_min, $match_max) = explode(",", $match);                 if($gender != $match_gender && $os == $match_os && $match_min <= $age &&              $match_max >= $age && $min <= $match_age && $max >= $match_age && similar_text ($type, $match_type) >= 1) {     ?> 


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -