Jump to content

zatox123

New Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by zatox123

  1. thanks for the help! really appreciate it
  2. so would it end up looking like this? When i run the program it doesnt work lol so i think I messed something up. <?php $names=array('duck','chicken','turkey','axolotl'); $prices=array(7,5,18,200); print "<table> <tr> <th>Select</th> <th>Animal</th> <th>Price</th> </tr>”; for ($i=0; $i<=3; $i++) { </td><td> $item=$names[$i]; $cost=$prices[$i]; print "<tr><td><input type='radio' name='purchase' value='$i'> $item </td><td> $cost</td></tr>"; } print "</table>"; ?>
  3. thanks for the help guys!
  4. Hello everyone, I am taking a php course and was given some practice problems to do but was not given any answers to check my work. I am VERY confused with what to do with Part 2 of this problem. For the first part I was supposed to code this bit of code which I all ready did. What I need help with is the second part... Here is the code I made that I am supposed to modify <?php $names=array('duck','chicken','turkey','axolotl'); $prices=array(7,5,18,200); print "<table>"; for ($i=0; $i<=3; $i++) { $item=$names[$i]; $cost=$prices[$i]; print "<tr><td><input type='radio' name='purchase' value='$i'> $item </td><td> $cost</td></tr>"; } print "</table>"; ?> The directions are "Modify my program listed above, to provide a correctly positioned caption row for the table with captions "Select", "Animal" and "Price" at the head of each column. I am really unsure of how to go about doing this. If anyone could help me out with some tips or just show me an answer so I can see how you did it I would greatly appreciate it.
  5. Oh I see! Awesome thanks for the tips, really appreciate it!
  6. Hey so I am a complete newbie and am taking a course to teach me php. I was given some practice problems to do but I was not given any answers to see if my work was correct. Can anyone check my work and/or give me some tips or answers to these problems? I would greatly appreciate it. Assume that an array named $list is given to you. It contains ten numbers in cells 0 through 9. Some of the numbers are negative. You don't need to waste time writing the code to create $list. Assume it exists already. It might not contain the same numbers as the example below. Write a small piece of code including a 'for' loop that would add up all the numbers in the $list which are greater than or equal to 4, and then print "The sum of biggies is ", followed by the sum. For instance, if the list is (8, 1, 7, -7, 2, 4, 5, -14, 0, 1) then the sum of the biggies is 24. Your code will also print out "There were $n zeros and $m biggies.", where $n is replaced by the number of zeros found in the list, and $m is the number of values greater than or equal to 4. In our example, it would print “There were 1 zeros and 4 biggies.” #list=array(8,1,7,-7,2,4,5,-14,0,1) $for ($i=0;$i<10;$i++) { $x=$list[$i]; if ($x>4) { $total=$total+$x; $biggies++;//biggies=$biggies+1; } else if ($x==0) { $zeros++; ] print "The sum of biggies is $biggies That is where I got stuck, I didn't really get the second part ><
×
×
  • 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.