Solved

dynamically assigning value to the textbox based on precondition

Posted on 2009-05-18
3
264 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

821 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