Jump to content

reub77

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

reub77's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm having issues trying to retrieve variables in a For Loop. The page I'm trying to do this on is retrieving a number of variables defined by the user. If the user states they need to add 10 users to teh system then I need to retrieve 4 variables associated with each user. Each variable is named with a number at the end. eg. First Name would be $fname1 Last Name would be $lname1 Date of Employment would be $doe1 Now, if 18 users are required I then allow the user to enter this info for all 18 users. The trouble I'm having is calling all this data to be inserted into a mail function. Here's my code: [code] for ($counter = 1; $counter <= $numcov; $counter++)     {       $a .= "User #".$counter.": $fname".$counter." $lname".$counter." Date of Employment: $doe".$counter."\n\n";     } [/code] I'm counting on being able to use the number in the variable name to call each of the user defined amount of variables. Is my code correct? Is there a better way to do this? Thanks [b]EDITED BY WILDTEEN88: PLEASE USE THE CODE TAGS WHEN SUBMITTING CODE. THE PHP TAGS NO LONGER EXIST[/b]
×
×
  • 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.