MCBeasley.GFX Posted April 8, 2011 Share Posted April 8, 2011 I normally don't work with PHP or rather I'm learning as I go..and this is pretty much my last barrier between completing this project. Anyway here are my two files: http://pastebin.com/aThU3akC - file i want to grab values from and pass to the file below http://pastebin.com/kTYHr99p - file that is suppose to display the values in $transmessage Basically I need the variables defined in the first file to be passed and usable in the second and I'm not sure why I can't Quote Link to comment https://forums.phpfreaks.com/topic/233099-variables-not-passing/ Share on other sites More sharing options...
KevinM1 Posted April 8, 2011 Share Posted April 8, 2011 Which variables, specifically, are you trying to pass? General tips: Never, ever, ever use the 'global' keyword. Pass parameters to a function through its argument list. That's why argument lists exist. You also don't need to pass $_POST in through an argument list. $_POST is always available to you. Finally, rather than manually include-ing your class files, look into autoload-ing them instead. Quote Link to comment https://forums.phpfreaks.com/topic/233099-variables-not-passing/#findComment-1198826 Share on other sites More sharing options...
MCBeasley.GFX Posted April 8, 2011 Author Share Posted April 8, 2011 Im trying to pass the variables in the hidden fields from the form in the first file to my 2nd file so I can display certain ones in the transmessage. Quote Link to comment https://forums.phpfreaks.com/topic/233099-variables-not-passing/#findComment-1198829 Share on other sites More sharing options...
KevinM1 Posted April 8, 2011 Share Posted April 8, 2011 Do you ever actually invoke your epn_submit functions? All I see in your second file is you directly accessing epn_class' data members. Since these are hidden input values, you need to: 1. Display your form (which is done by echoing the return value of one of your epn_submit functions) 2. Submit your form 3. Capture the $_POST values in the second file. Just writing a function definition does NOT make the function run. You need to invoke it by: $ps = new epn_class(); echo $ps->epn_submit(); Depending on which function you actually need to run. A class definition is simply a blueprint. It's up to you to create an object of that class and invoke its functions. Quote Link to comment https://forums.phpfreaks.com/topic/233099-variables-not-passing/#findComment-1198843 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.