Solved

syntax error - Am I missing something

Posted on 2007-11-20
9
236 Views
Last Modified: 2013-11-18
I generate a form with the PHP IDE and it runs. I put a button on that forms and it runs. I attached code to that button to change the Caption when it is clicked and I get the following:
Parse error: syntax error, unexpected '='
No matter what I do, I get a syntax error The code is below.
NOTE : I have not included all three statements in the code at the same tmie. I include all three here only to show what I have tried. On the other hand if I simply put in Button1.Caption; it does not flag that as an error and the forms is displayed.

What in the world am I missing?
function Button1Click($sender, $params)
               {
               Button1.Color = 5;
               $sender.color = 5;
               Button1->caption = "test";
               }

Open in new window

0
Comment
Question by:evault
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
9 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 20322191
what language is/should be that code?
0
 
LVL 1

Author Comment

by:evault
ID: 20322329
I am trying to program in PHP, but obviously I am not connecting the dots. I even put the PHP tags (<?php ?> around the code and got an error stating unexpetced '<'.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 20322581
>  Button1.Color = 5;
is no PHP syntax, should probably be
   $Button1.Color = 5;
0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
LVL 1

Author Comment

by:evault
ID: 20322654
Tried that, same error:   Parse error: syntax error, unexpected '=' in C:\....
If all else fails, what the java script syntax be?
0
 
LVL 1

Author Comment

by:evault
ID: 20322674
here is the whole thing: This doesn't make sense. I have programmed in PHP before and something just isn't clicking here.

<?php
        //Includes
        require_once("vcl/vcl.inc.php");
        use_unit("comctrls.inc.php");
        use_unit("forms.inc.php");
        use_unit("extctrls.inc.php");
        use_unit("stdctrls.inc.php");
 
        //Class definition
        class Unit1 extends Page
        {
               public $Button1 = null;
               public $Edit3 = null;
               public $Label3 = null;
               public $Edit2 = null;
               public $Label2 = null;
               public $Edit1 = null;
               public $Label1 = null;
               public $PageControl1 = null;
               function Button1Click($sender, $params)
               {
                 echo "this is a test";
                 $sender.Color = 5;
               }
 
 
 
 
         }
 
        global $application;
 
        global $Unit1;
 
        //Creates the form
        $Unit1=new Unit1($application);
 
        //Read from resource file
        $Unit1->loadResource(__FILE__);
 
        //Shows the form
        $Unit1->show();
 
?>

Open in new window

0
 
LVL 21

Expert Comment

by:nizsmo
ID: 20322877
Try:
<?php
        //Includes
        require_once("vcl/vcl.inc.php");
        use_unit("comctrls.inc.php");
        use_unit("forms.inc.php");
        use_unit("extctrls.inc.php");
        use_unit("stdctrls.inc.php");
 
        //Class definition
        class Unit1 extends Page
        {
               public $Button1 = null;
               public $Edit3 = null;
               public $Label3 = null;
               public $Edit2 = null;
               public $Label2 = null;
               public $Edit1 = null;
               public $Label1 = null;
               public $PageControl1 = null;
               function Button1Click($sender, $params)
               {
                 echo "this is a test";
                 $sender->Color = 5;
               }
 
 
 
 
         }
 
        global $application;
 
        global $Unit1;
 
        //Creates the form
        $Unit1=new Unit1($application);
 
        //Read from resource file
        $Unit1->loadResource(__FILE__);
 
        //Shows the form
        $Unit1->show();
 
?>

Open in new window

0
 
LVL 1

Author Comment

by:evault
ID: 20322988
No syntax error, but on the otherhand it didn't really do anything. Here is an obvious question: Can a Button's Caption property actually be changed on the fly in PHP?
0
 
LVL 21

Accepted Solution

by:
nizsmo earned 500 total points
ID: 20323074
you had a syntax error before, i don't think you can use the dot notation in php, you have to use ->
if you require a onclick event for the button to call some function in PHP, what you will need is AJAX to do this. Without AJAX you cannot just call the php function as PHP is a server-side langauge and you are dealing with clientside parts of the content.
0
 
LVL 1

Author Closing Comment

by:evault
ID: 31410171
I am dumber than a stick. In checking my notes and pouring over some books I realized, as you pointed out, that PHP is used for building forms on the fly, not for interacting with users.
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Perl script to process a .csv file 18 66
Need help Creating PowerShell Script 5 67
IntelliJ and Eclipse Neon 2 installations 4 43
Java array 10 68
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question