Solved

dynamically assigning value to the textbox based on precondition

Posted on 2009-05-18
3
261 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
Comment Utility
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
Comment Utility
try
{php} if ($i+1 == 1){ echo "1500";} else { echo "1000"; } {/php}

Open in new window

0
 
LVL 11

Author Closing Comment

by:mattibutt
Comment Utility
thanks buddy
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now