OK, then apply some logic to what you found:
- the correct values are coming from the form and are in the $_POST array
- these values are not getting into the variables $temp and $temp_lk
- therefore, the problem is at the point where you assign values to those variables
Which brings us to the expression
$_POST["sw$i"]. That looked to me like it should work, but the above logic makes it pretty clear that it isn't working. So what can you do? Well, first you could check to see that there is actually a value in
$i at that point. Try echoing out the value of $i just before the assignments to those variables. Try echoing out the expression
sw$i and see what value that produces. Maybe you will see something wrong there. If not, I could be mistaken about the syntax $_POST["sw$i"], although I thought that I had used something like that once or twice. The important thing is for you to learn how to search for a problem like this so the next time you have some kind of a PHP problem, you will be better equipped to handle it. Let us know what you find out.