473,387 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Conditional display of an item

Hi All

Thanks for the replies to my previous questions. I have some code down there to enable editing of a field called 'Usr_Surname' if the value of the variable 'authorise' is one . If the variable authorise is any other value than one I want to display the field 'Usr_Surname' without allowing users to edit it. The code is not working. I need some help. Thanks

[PHP]</tr>
<tr>
<td class="hr"><? echo htmlspecialchars("Surname")."&nbsp;" ?></td>
<td class="dr"><? if ($authorise=='1') ?><textarea cols="35" rows="4" name="Usr_Surname" maxlength="100"><? echo str_replace('"', '&quot;', trim($row["Usr_Surname"])) ?></textarea>
<? else echo trim($row["Usr_Surname"]) ?></td>
</tr>
<tr>[/PHP]
Jun 20 '07 #1
1 1166
pbmods
5,821 Expert 4TB
Heya, sharmilah.

If the variable authorise is any other value than one I want to display the field 'Usr_Surname' without allowing users to edit it. The code is not working. I need some help.
Try using a PHP echo statement:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. if ($authorise=='1')
  3.     echo '<textarea cols="35" rows="4" name="Usr_Surname" maxlength="100">' . htmlspecialchars(trim($row["Usr_Surname"])) . '</textarea>';
  4. ?>
  5.  
If this doesn't work, I'd check to make sure $authorise actually has a value (did you mean $authorize?).

PS. As a sidenote:
Expand|Select|Wrap|Line Numbers
  1. <? echo htmlspecialchars("Surname")."&nbsp;" ?>
  2.  
  3. // Wouldn't this do the same thing?
  4. Surname&nbsp;
  5.  
Jun 20 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Hans van Dijk | last post by:
Hi there, Is there anybody who knows were to find a javascript that does the trick of conditional pulldowns (3). Here is what i am looking for: When you select an item from the first...
2
by: rudy | last post by:
I am trying to highlight the output of a field to display something similar to conditional formating. Would prefer to display the result with a code instead of a colored font or colored background...
2
by: Von Bailey | last post by:
I have a form where the conditional formatting is set on some fields to bold if certain conditions are met. However, when the conditions are met some of the data that is to bold is either not...
1
by: Steve Bywaters | last post by:
In conventional ASP, I would often conditionally display some rows of a (data-loaded) table - for example, group headers/footers. Simple to do... In ASP.NET, with the use of DataGrid (etc), this...
1
by: Tom Wells | last post by:
I have a few things such as buttons and URLs that may or may not be shown based on the value of a database column. I can hook to the database and get the dataset and datarecord just fine. I can...
1
by: bijoy | last post by:
My datagrid displays the following info: Date, Expected Users, Number of Events I want it to behave as follows: For each row, if the value of Expected Users is greater than 5000, then I...
2
by: Kumar | last post by:
Hi Folks, I have a question regarding conditional hyperlink in datagrid of asp.net ,c# application I want to display Hyperlink if my QID values in (1,4,5,6) other wise i want to display...
1
by: euan | last post by:
HI Guys, I have bee using conditional formatting in the datagrid recently and I am moving over to framework 2.0 and noticed the datagrid has been replaced by the gridview. So, I would like to do...
10
by: Richard Gilmore | last post by:
I want the feild total to display the total cost of an item, If the item has vat a yes no box is ticked in the field vat and I have the price of the item without vat. I want the feild total to...
1
by: Mark A | last post by:
I've got a continuous form that is just for display, so hence all items on it are set to Enabled = No, Locked = Yes. This has the desired effect of making the item unclickable - exactly what I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.