Solved

dynamically assigning value to the textbox based on precondition

Posted on 2009-05-18
3
263 Views
Last Modified: 2012-05-07
hi
i have textbox which is the following
      <input name="quiz_time_unused" type="text" id="quiz_time_unused"  class="inputbuttont" size="4" value="1500" />

i have another textbox which contain dynamic values
 <input name= "waitq" type="hidden" id="waitq"  value="{php}echo $i+1; {/php}"/>

i want to change the quiz_time_unused value using php if statement
if $i+1 = 1
then quiz_time_unused = 1500
else quiz_time_unused = 1000



0
Comment
Question by:mattibutt
  • 2
3 Comments
 
LVL 11

Author Comment

by:mattibutt
ID: 24411452
i have wrote it like this doesn't seem to be working {php} is written like this because this textbox is on the smarty page

<input name="quiz_time_unused" type="text" id="quiz_time_unused"  class="inputbuttont" size="4" value="{php} if ($i+1 == 1){
      
"1500";
}
else {
 "1000";
} {/php}"/>
0
 
LVL 5

Accepted Solution

by:
bored321 earned 500 total points
ID: 24411467
try
{php} if ($i+1 == 1){ echo "1500";} else { echo "1000"; } {/php}

Open in new window

0
 
LVL 11

Author Closing Comment

by:mattibutt
ID: 31582563
thanks buddy
0

Featured Post

3 Use Cases for Connected Systems

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

Question has a verified solution.

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

Suggested Solutions

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

832 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