I'm receiveing the warning

Strict warning: Only variables should be passed by reference in eval() (line 2 of D:\wwwroot\tixers\modules\php\php.module(80) : eval()'d code).

Everywhere I've looked tells me its a render error but I can't find anything wrong. The form works and submits all my info to the database, but there warning still shows up.

If you need the code for the module let me know and I will reply to it.


I use

print drupal_render(drupal_get_form('sellTickets_form'));

then in the form 'sellTickets_form

function sellTickets_form($form, &$form_state) {

$form['team'] = array(
    '#type' => 'textfield',
    '#title' => t('Team Name:'),
    '#size' => 30,
    '#required' => TRUE,

......break for forms.....

$form['total_points'] = array(
    '#type' => 'textfield',
    '#title' => t('Total Points Awareded'),
    '#size' => 30,
    '#required' => TRUE,
$form['submit'] = array(
    '#type' => 'submit', 
    '#value' => t('Submit'),
return $form;


function sellTickets_form_validate($form, &$form_state){ 

function sellTickets_form_submit($form, &$form_state) {
    global $user;
    $uid = $user->uid;
    $team = $form_state['values']['team'];
    $price = $form_state['values']['price'];
    $section = $form_state['values']['section'];
    $row = $form_state['values']['row'];
    $seat = $form_state['values']['seat'];
    $quantity = $form_state['values']['quantity'];
    $opponent = $form_state['values']['opponent'];
    $date = $form_state['values']['date'];
    $location = $form_state['values']['location'];
    $description = $form_state['values']['description'];
    $total_points = $form_state['values']['total_points'];
    $organization = $form_state['values']['organization'];

    db_query("INSERT INTO ticket (
    `TEID`, `price`, `location`, `date`, `organization`, `section`, `row`, `seat`, `quantity`, `opponent`, `description`, `points`) 

    VALUES ('".$team."', '".$price."', '".$location."', '".$date."', '".$organization."','".$section."', '".$row."', '".$seat."', '".$quantity."', '".$opponent."', '".$description."', '".$total_points."');"
  • 2
    Putting the code in would help, but if you read and understand the answer to this question you should be able to find the error quite easily – Clive Feb 20 '13 at 18:14
  • I've read that question and I'm not referencing a variable. I am not using node_show or a var. I use – tht1kid Feb 20 '13 at 18:43
  • If you can edit your code into the question I'm sure it'll be simple enough to spot... – Clive Feb 20 '13 at 18:44

drupal_render() takes it's first argument by reference. This'll fix it:

$the_form = drupal_get_form('sellTickets_form');
print drupal_render($the_form);
  • Works perfect. I guess to many shortcuts. thanks! – tht1kid Feb 20 '13 at 18:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.