PHP-GTK2 Cookbook Forum
Welcome, Guest
Please Login or Register.    Lost Password?
Re:my code is not working (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:my code is not working


#2925
jrthor2 (User)
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
my code is not working 9 Months, 3 Weeks ago Karma: 0  
I am able to echo statements using the plugin, so I know it's working. I have the below code, where I want to display a message and hide my form when a user successfully completes my form. I am seeing the message and the form at all times, it's not going through my if condition. I am using the TinyMCE editor if that matters, and i have the plugin configured to 'No' for 'Using No Editor'.
Code:
<?php

$submitValue= JRequest::getVar('submit');

echo "submitValue: " . $submitValue;

if ($submitValue == 1) {

?>

Your request has been submitted.  We will contact you as soon as possible

<?php } else { ?>

{loadposition content_request_speaker}

<?php } ?>

Thanks
 
  The administrator has disabled public write access.

#2928
kksou (Admin)
Admin
Posts: 1240
graph
User Online Now Click here to see the profile of this user
Re:my code is not working 9 Months, 3 Weeks ago Karma: 20  
Hi,

You have intermixed PHP with HTML. This won't work.

DirectPHP is a very straightforward plugin that simply grabs your PHP statements and pump it through the default PHP's eval() command.

PHP's eval() statement parses ONLY php statements. It does not parse a mix of PHP and HTML. Hence your statements will not be parsed.

For your case, just change your statements into pure PHP, e.g.

Code:
<?php

$submitValue= JRequest::getVar('submit');

echo "submitValue: " . $submitValue;

if ($submitValue == 1) {

echo 'Your request has been submitted.  We will contact you as soon as possible';

} else {

echo '{loadposition content_request_speaker}';

}
Regards,
    /kksou
     
      The administrator has disabled public write access.

    #2932
    jrthor2 (User)
    Fresh Boarder
    Posts: 4
    graphgraph
    User Offline Click here to see the profile of this user
    Re:my code is not working 9 Months, 2 Weeks ago Karma: 0  
    that doesn't work. I don't get my form on my page, I just get a blank page. I don't think having

    echo '{chronocontact}Request_A_Speaker{/chronocontact}';

    get's evaluated properly.
     
      The administrator has disabled public write access.
    #2936
    kksou (Admin)
    Admin
    Posts: 1240
    graph
    User Online Now Click here to see the profile of this user
    Re:my code is not working 9 Months, 2 Weeks ago Karma: 20  
    Please go to the Plugins Manager.

    Can you tell me the order that you see in the Plugins Manager for
    1) DirectPHP
    2) chronocontact

    Regards,
    /kksou
     
      The administrator has disabled public write access.
    #2937
    jrthor2 (User)
    Fresh Boarder
    Posts: 4
    graphgraph
    User Offline Click here to see the profile of this user
    Re:my code is not working 9 Months, 2 Weeks ago Karma: 0  
    chronocontact and DirectPHP both have an order of 0, but chronocontact is listed first, since they are listed alphabetically.
     
      The administrator has disabled public write access.
    #2938
    kksou (Admin)
    Admin
    Posts: 1240
    graph
    User Online Now Click here to see the profile of this user
    Re:my code is not working 9 Months, 2 Weeks ago Karma: 20  
    Please try the following:

    1) Set the order of DirectPHP as 1

    2) Set the order of chronocontact to be 10, 11 or any order greater than 10.

    Reload your article. Let me know if it works.

    Regards,
    /kksou
     
      The administrator has disabled public write access.
    #2941
    jrthor2 (User)
    Fresh Boarder
    Posts: 4
    graphgraph
    User Offline Click here to see the profile of this user
    Re:my code is not working 9 Months, 2 Weeks ago Karma: 0  
    yes, it's working. I changed DirectPHP to 1 and chronocontact to 2, and it's working. Thanks!!
     
      The administrator has disabled public write access.



    Go to top Post Reply
    Powered by FireBoardget the latest posts directly to your desktop

    Blog - Forum - Privacy Policy - Contact Us
    Copyright © 2006-2009. kksou.com. All Rights Reserved