Jump to content

Variables not passing


MCBeasley.GFX

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/233099-variables-not-passing/
Share on other sites

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.