I have a long list of variables and I want to list all the values in order (the name and its number) for example $name='John'; $number='1234'; $link='http://link.com'; Code (markup): <a href="<?php echo $link ?>" class="name"><?php echo $name ?></a> <div class="number"><?php echo $number ?></div> Code (markup): is there any way to do that?
How exactly does your list look like? It can't be like that: $name='John'; $number='1234'; $link='http://link.com'; PHP: ... since you'd just be redefining the existing variables. Are you using an array? (You should!)... be more specific.
<?php $name='John'; $number='1234'; $link='http://link.com'; $list = array(John, 1234, http://link.com); ?> $list <br><br> Hello $name your pin number is $number here is the link to where you enter you pin number - $link PHP:
Post that list please. Or at least a bit more of what you've posted already. Is it LIKE a database, or IS it a database? You really have to be more specific about what you already have and what you want to accomplish.
sorry nico_swd but I don't have the list right now. I'm making a website to list all employees names and numbers each employee has a variables for his name and phone number. I want to list all of the the data in one page. Name: john Phone: 1234 name: sara Phone:4321 Code (markup): Is there a way to do it without making a variable for every employee
<?php $employee[0] = "John Smith, 555-555-5555"; $employee[1] = "John Smith, 555-555-5555"; $employee[2] = "John Smith, 555-555-5555"; $employee[3] = "John Smith, 555-555-5555"; $employee[4] = "John Smith, 555-555-5555"; echo "Employee 1 " . $employee[0]; echo "<br />Employee 2 " . $employee[1]; echo "<br />Employee 3 " . $employee[2]; echo "<br />Employee 4 " . $employee[3]; echo "<br />Employee 5 " . $employee[4]; ?> PHP:
--- --- --- Ok i Made a Mistake this is how you do it heres an example: http://cynscriptz.com/employee.php <?php $employee[0] = "John Smith, 555-555-5555"; $employee[1] = "John Smith, 555-555-5555"; $employee[2] = "John Smith, 555-555-5555"; $employee[3] = "John Smith, 555-555-5555"; $employee[4] = "John Smith, 555-555-5555"; echo "Employee 1 " . $employee[0]; echo "<br />Employee 2 " . $employee[1]; echo "<br />Employee 3 " . $employee[2]; echo "<br />Employee 4 " . $employee[3]; echo "<br />Employee 5 " . $employee[4]; ?> PHP:
No Problem im sorta new to PHP trying to learn XD nico_swd is the best guy to ask for php help but he wont just give you a soloution he will make you learn how to do it
Lol, oh I do when I feel like it's appropriate. I'm just under the impression that some people don't even try to solve their own problems. (That isn't directed at ahdflash, just generally saying).
Btw, this can be much simplified: ... to: <?php $employee[0] = "John Smith, 555-555-5555"; $employee[1] = "John Smith, 555-555-5555"; $employee[2] = "John Smith, 555-555-5555"; $employee[3] = "John Smith, 555-555-5555"; $employee[4] = "John Smith, 555-555-5555"; foreach ($employee AS $key => $person) { $key++; echo "Employee {$key}: {$person}<br />\n"; } ?> PHP: ... this way you can add as many as you want, and you just have to add them to the array and not the list as well.