[PHPLIB] unable to use a variable in form element From: Bruce Snyder (bws <email protected>)
Date: 12/09/99

I am unsuccessful in setting a variable to the value of a hidden form
element. Here is my code:

------------------------------------------
<?php

include( '/usr/www/Date.inc'); // for week of year calc
$date = new Date;

class StatusForm extends tpl_form
{

   var $classname = "StatusForm";
   var $form_data;

   function setup_fields()
   {
      $this->form_data->add_element(array( "type"=> "hidden",
                                           "name"=> "week_ending",
                                           "value"=>
"$date->week_num"));
...
} // end class StatusForm
------------------------------------------

Notice the value of the hidden field named week_ending should be the
variable $date->week_num. I've tried it with double quotes, with single
quotes, with no quotes, etc. and it will not report the contents of
$date->week_num. When the hidden field is output its value is empty.

I wrote a little test file and $date->week_num is being calculated
properly.

Thanks,
Bruce Snyder
-
PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in
the body, not the subject, of your message.