You are missing the $ sign in front of the variable name, change it to $username, bye!
cereal
Veteran Poster
1,144 posts since Aug 2007
Reputation Points: 344
Solved Threads: 222
Skill Endorsements: 22
The same goes for the password variable.
broj1
Nearly a Posting Virtuoso
1,211 posts since Jan 2011
Reputation Points: 167
Solved Threads: 164
Skill Endorsements: 13
As TonyG said put a closing php tag on line 14 in above code.
broj1
Nearly a Posting Virtuoso
1,211 posts since Jan 2011
Reputation Points: 167
Solved Threads: 164
Skill Endorsements: 13
Probably you get an empty set from this query:
SELECT * FROM PO ORDER BY PO ASC
Try it from a mysql client.
cereal
Veteran Poster
1,144 posts since Aug 2007
Reputation Points: 344
Solved Threads: 222
Skill Endorsements: 22
As cereal said run the query:
SELECT * FROM PO ORDER BY PO ASC
in phpmyadmin (or mysql client) and see if you get the correct resultset for options in your select. If the query returns correct result then check the html code (in Firefox right click -> View page source) and check whether there are no html errors also.
You might want to check whether isSelected($item['po'],$batch) function returns correct value.
broj1
Nearly a Posting Virtuoso
1,211 posts since Jan 2011
Reputation Points: 167
Solved Threads: 164
Skill Endorsements: 13
<b>Fatal error</b>: Call to undefined function isSelected() in <b>C:\xampp\htdocs\Innovation\script_shop\stock.php</b> on line <b>48</b><br />
This is probably the answer: the isSelected() function that you are calling, does not exist. Have you included appropriate file where the function should be defined?
And also
Undefined index: po in <b>C:\xampp\htdocs\Innovation\script_shop\stock.php
means that there are no records since nothing exists in the $item array.
broj1
Nearly a Posting Virtuoso
1,211 posts since Jan 2011
Reputation Points: 167
Solved Threads: 164
Skill Endorsements: 13
You should temporary remove the isSelected($item['po'],$batch) function and see if you get anything:
while ($item = mysql_fetch_assoc($result))
{
echo '<option value="'.$item['po'].'" . $item['namn'] . '</option>';
}
The isSelected() function probably only adds selected="selected" to selected option.
broj1
Nearly a Posting Virtuoso
1,211 posts since Jan 2011
Reputation Points: 167
Solved Threads: 164
Skill Endorsements: 13
Sory it should be:
echo '<option value="'.$item['po'].'">' . $item['namn'] . '</option>';
My error when copying.
broj1
Nearly a Posting Virtuoso
1,211 posts since Jan 2011
Reputation Points: 167
Solved Threads: 164
Skill Endorsements: 13
This is tricky.
What you get when you run this query in phpmyadmin:
SELECT * FROM PO ORDER BY PO ASC
broj1
Nearly a Posting Virtuoso
1,211 posts since Jan 2011
Reputation Points: 167
Solved Threads: 164
Skill Endorsements: 13
This is mysterious. The code in the snippet you posted seem to be OK (once corrected with suggestions from other posts). Can you post the whole code? I would have to test it in my environment to try to find something.
broj1
Nearly a Posting Virtuoso
1,211 posts since Jan 2011
Reputation Points: 167
Solved Threads: 164
Skill Endorsements: 13