Jump to content

[SOLVED] Random output from an array list


ironman32

Recommended Posts

I have the idea of having data from an array list being chosen at random an input into table. The problem is that I'm not sure if this is possible .

 

The idea is that the user clicks on a link and when they are taken to the page they will be shown data at random.

 

Here is the page where the link resides.

<html>
<body>

<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>

<td colspan="3"><strong>In which area do you wish to increase your muscle?</strong></td>
</tr>

<tr>
<td width="100"><a href="uppergen.php">Upper</a>
</tr>
</td>
<tr>
<td width="100">Lower body
</td>
</tr>
<tr>
<td width="100">Total body (Combination of upper and lower body)
</td>

</tr>
</td>	


</body>
<html>

 

And this is the page it links to with the array list

<?php
$shoulder_array = array();
$shoulder_array[0] = "<a href=\"http://www.muscleandstrength.com/exercises/military-press.html\">Military press (Barbell)</a>";
$shoulder_array[1] = "<a href=\"http://www.muscleandstrength.com/exercises/military-press.html\">Military press</a>";
$shoulder_array[2] = "<a href=\"http://www.muscleandstrength.com/exercises/military-press.html\">Military press</a>";
$shoulder_array[3] = "<a href=\"http://www.muscleandstrength.com/exercises/military-press.html\">Military press</a>";


?>

<html>
<body>
A minimum rest period of one day is required between each workout day.

<table border="1">

<tr><td rowspan="2">Day 1</td>
<td>Stretch/Warm up </td><td><?php echo $shoulder_array[0]; ?></td>  
<td><?php echo $shoulder_array[2]; ?></td><td>

<td><?php echo $shoulder_array[3]; ?></td><td>

<td><?php echo $shoulder_array[3]; ?></td>


</tr>

</table>
<p></p>

<table border="1">

<tr><td rowspan="2">Day 2</td>
<td>Stretch/Warm up </td><td><?php echo $shoulder_array[0]; ?></td>  

</tr>

</table>



</body>
</html>

 

The idea is to have the data put in at random.

 

Any help would be appreciated

Link to comment
https://forums.phpfreaks.com/topic/151074-solved-random-output-from-an-array-list/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.