skycruiser Posted February 16, 2007 Share Posted February 16, 2007 I'm a php/mysql noob and I'm a little stuck at the moment. I've got one page that generates a set of POST variables (number depends on the number of records in a mysql query). The vars are doc_master0, doc_master1 etc. That part works fine. I can see that the variables are available on the next page. I can echo them directly. But I'm trying to access those variables in a loop and there's where I'm running into trouble. In my loop with index 'i', I'm creating a temp variable $doc_master_temp = "doc_master".$i; But if I try to retrieve that post variable with $doc_master = $POST_["doc_master_temp"]; I get an error undefined POST variable. I also tried $doc_master = $POST_["$doc_master_temp"]; Is there any way to get this to work or do I need a completely different approach (arrays or something??). Thanks for the help! MIchael Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 16, 2007 Share Posted February 16, 2007 It's $_POST not $POST_ Quote Link to comment Share on other sites More sharing options...
skycruiser Posted February 16, 2007 Author Share Posted February 16, 2007 lol i'm an idiot. Stupid typos!!! Awesome works now (with the $var, not just var). Thanks for the quick reply. I've been banging my head all morning. Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 16, 2007 Share Posted February 16, 2007 Also, don't put the variable in a string in the post if it's just the var. $_POST[$doc] not $_POST["$doc"] - it's extra work for PHP to do that way. Quote Link to comment Share on other sites More sharing options...
skycruiser Posted February 16, 2007 Author Share Posted February 16, 2007 Thanks for the tip. I'm sure a pro could find hundreds of things I'm doing in an inefficient way Great forum by the way. I'll try to limit my quesions to real problems, not stupid syntax errors!! Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 16, 2007 Share Posted February 16, 2007 No problem, good luck Quote Link to comment Share on other sites More sharing options...
skycruiser Posted February 16, 2007 Author Share Posted February 16, 2007 Can't PM yet. wanted to say I'm also in Richardson TX - at UTD. And I noticed you do freelance work. Once my database is done and ready to go online we may want an "expert" review for security issues or other general advice. I'll keep you in mind when we get there (if you're interested). MIchael Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 16, 2007 Share Posted February 16, 2007 I'm at UTD too - I'm actually in class right now Feel free to contact me if you need anything. Quote Link to comment Share on other sites More sharing options...
skycruiser Posted February 16, 2007 Author Share Posted February 16, 2007 Cool i'm in the SU having coffee - work in the Westec building - Physics dept. Not sure how to contact you - my email is perdue@ (you know the rest - campus mail). 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.