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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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