Frank Ly
Frank Ly

Reputation: 639

autofill this html field?

what would be the easiset way to autofill this field??

<input type="text" name="start_price" value="<?=$item_details['start_price'];?>" size="8"></td>

i need to keep the $item_details because it gets passed to some other code, but in some cases i want to autofill this as 0.00 to make it easier for me as i will be using 0.00 to list some auctions

i am editing a template that is being used by php to generate some code, so ideally i just want to make some changes to the templates without having to dive into the code itself

Upvotes: 0

Views: 640

Answers (1)

jlengstorf
jlengstorf

Reputation: 447

Something like this sounds like it might solve your problem:

<?php
  // Whatever logic determines a "special case" stores a boolean value 
  // into the variable $special_case
  $input_value = !$special_case ? $item_details['start_price'] : '0.00';
?>
<input type="text" name="start_price" value="<?php echo $input_value; ?>" size="8">

Upvotes: 1

Related Questions