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
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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.