darkhappy Posted May 12, 2008 Share Posted May 12, 2008 I am getting an error when processing this code - could anyone give me the proper syntax/puntuation for this? <?php while ($a = mysql_fetch_array($approvals)) { if(isset($_POST['{$a['approvals']}'])) { $sheetid = $_POST['{$a['approvals']}']; } } ?> Quote Link to comment Share on other sites More sharing options...
dezkit Posted May 12, 2008 Share Posted May 12, 2008 <?php while ($a = mysql_fetch_array($approvals)) { if(isset($_POST['{$a["approvals"]}'])) { $sheetid = $_POST['{$a["approvals"]}']; } } ?> Quote Link to comment Share on other sites More sharing options...
btherl Posted May 12, 2008 Share Posted May 12, 2008 Try this: <?php while ($a = mysql_fetch_array($approvals)) { if(isset($_POST[$a['approvals']])) { $sheetid = $_POST[$a['approvals']]; } } ?> The syntax for how you were trying to do it is like this: $val = "{$a['approvals']}"; Quote Link to comment Share on other sites More sharing options...
darkhappy Posted May 12, 2008 Author Share Posted May 12, 2008 i will have to try that next time... instead i tweaked this function to pull the key out of the variable once it is posted. lots of work for a 1 little number hehe! <?php function get_sheet() { $context = '_POST'; global $$context; if(isset($$context)) { foreach($$context as $k => $v) { $sheetid = $k; } } } get_sheet(); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.