a simple question

This is where you share YOUR scripts with others

Moderators: macek, egami, gesf

Post Reply
User avatar
php-forum GURU
php-forum GURU
Posts: 2196
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: a simple question

Post by egami » Thu Aug 23, 2012 1:15 pm

Your Code...

Code: Select all

for ($j=0; $j<4; $j++)
 $given=array( //S O S 
"$j" => $_POST{"answer$j"}); 
echo "answer to".$j ."=> ". $given[$j] . "<br />";
 } //until hera it prints the given answers

 echo "<h1>SOSapanthsh sthn 0=> ". $given[0] . "<br /></h1>"; //but here ..prints a notice

Try this..

Code: Select all

$i = 4;
for ($j = 0; $j < $i; $j++) { 
$given[$j] = $_POST['answer'.$j];
echo "Answer to $j => $given[$j]<br>";

echo '<h1>SOSapanthsh sthn 0=> '.$given['0'].'</h1><br>';

echo '<pre>'; print_r($given); echo '</pre>';

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest