• $azonassoc = amazon_assoc_tag;
    $azonsecret = amazon_secret;
    $azonaccess = amazon_access;

    catching_var.php(‘$azonassoc’,’$azonsecret’,’$azonaccess’);

    I want to pass values from a FORM i have created to amazonapi.php but WordPress shouting Function not defined.
    I also would like to pass a film title to Amazon how do I do it? This is on a seperate PHP page than the settings page.

Viewing 3 replies - 1 through 3 (of 3 total)
  • That’s not now PHP works. The file contains the code, but a file name cannot be called as a function. The file needs to be included in which ever script you’re uisng to pass the values and then you can call what ever the function name is, eg:

    require_once( '/path/to/catching_var.php' );
    
    // I don't know your function name so making this one up!
    caching_var_function( $azonassoc, $azonsecret, $azonaccess );

    Also note that there’s no ‘s around the parameters. You pass them in as variables, not as strings.

    Thread Starter xymalf

    (@xymalf)

    at the moment I am running wordpress on a local server catching_var is located under www/WPDev/wp-content/plugins/WPTemplate/catching_var.php

    what should my path be in the above example and how would this change onto a live site?

    Most times I set up a variable or a constant to hold the local path and use PHP to get that. As an example, in the plugins main file, I’d do something like this:

    define( 'WPTEMPLATE_BASE_URI',  dirname( __FILE__ ) );
    
    require_once( WPTEMPLATE_BASE_URL . '/catching_var.php' );

    Of course I do that because I use that more then once, but if you’re only using in once you can do it all in one line.

    That will set up the required path and load the file so that you can use it’s functions where they are needed by your plugin.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Local WAMP server says function undefined’ is closed to new replies.