problem with submitted data

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
User avatar
mike
New php-forum User
New php-forum User
Posts: 73
Joined: Sun May 04, 2003 4:26 am
Location: Athens
Contact:

Post by mike » Mon May 05, 2003 8:30 am

I am not really sure but I came up with a similar problem like that. You are passing 19 variables to the 2nd file (teacher_#) and you want to use them all. That sounds ok but these variable must be used inside a loop. As I remember right you cannot pass increment variables inside a loop. Eg:

$var1 = "bla";
$var2 = "bla2";
$var3 = "bla3";

for($i=0;$i<=3;$i++){
echo "$var$i";
}


This wont work. But if you try store them in an array:

$var[1] = "bla";
$var[2] = "bla2";
$var[3] = "bla3";

for($i=0;$i<=3;$i++){
echo "$var[$i]";
}

will 100% work :) Hope you understood what is wrong ... dot have time to change your whole script :(

liquedus
php-forum Active User
php-forum Active User
Posts: 266
Joined: Tue Apr 08, 2003 5:18 am
Location: Ottawa, Canada
Contact:

Post by liquedus » Mon May 05, 2003 12:15 pm

reply to post above, he is using variable variables... so no need to use arrays.

try this also:

$count2 = mysql_numrows($result2);

make it

$count2 = mysql_num_rows($result2);

both your pages have this error... i will have a looksi again when I get back later

User avatar
mike
New php-forum User
New php-forum User
Posts: 73
Joined: Sun May 04, 2003 4:26 am
Location: Athens
Contact:

Post by mike » Mon May 05, 2003 1:12 pm

well sorry if I was misunderstood but was talking about the passing arguments (by the form) not the variable variables :)

liquedus
php-forum Active User
php-forum Active User
Posts: 266
Joined: Tue Apr 08, 2003 5:18 am
Location: Ottawa, Canada
Contact:

Post by liquedus » Mon May 05, 2003 5:57 pm

dont be sorry, maybe its me whos thinking of something else...

also to poster... if you are using dynamic variables this will not work:

$query = "select * from docentes where doc_id='$selectedteacher'";

change to:

$query = "select * from docentes where doc_id='$$selectedteacher'";

since dynamic variables require 2 $$

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest