Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


dynamically assigning value to the textbox based on precondition

Posted on 2009-05-18
Medium Priority
Last Modified: 2012-05-07
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

Question by:mattibutt
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 11

Author Comment

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){
else {
} {/php}"/>

Accepted Solution

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

Open in new window

LVL 11

Author Closing Comment

ID: 31582563
thanks buddy

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses four methods for overlaying images in a container on a web page
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.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

730 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