Jump to content

Function question


amg182

Recommended Posts

What do you mean by "I am trying to call variables inside a function".

 

In the code you posted above you are passing two values into the function as two parameters. Then, based upon the value of the first parameter, you are modifying the value of the 2nd parameter. And, that's it. You don't apss anything back from the function.

 

What exactly are you trying to accomplish with his function. It looks like you are using it to determine if a form field is disabled or not, but I'd be interested in seeing how you plan to use it.

Link to comment
Share on other sites

thanks for replies.

 

I have a form containg up to 13 select fields(comboboxes). I am writing an if statement to say if  the comboboxs contains a value then disable it, otherwise leave it enabled.

 

Here is the actual code i am working with:

 

if ( $select1 != "" ) {
   $cond="disabled";
}
else {
  $cond='onChange="filters.submit();"';
}

.....
<form name="filters" id="filters" action="index.php?" method="post">

<td><Select name='select1' id=" <?php echo $cond; ?>>
<option value.....

 

Rather than write this if statement 13 times, i thought i would use a function instead. Sorry i over complicated things earlier, thought i would strip the code down to make it easier to interpret.(Done the opposite probably)

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.