Jump to content

zelig

Members
  • Posts

    117
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

zelig's Achievements

Member

Member (2/5)

1

Reputation

  1. Okay, here's what I'm doing. It's sort of like a market script. When someone wants to buy something, they choose from a drop down the item they wish to buy. However, there is a setup cost for it to be started. Then, based upon the length they choose (anywhere from 1 - 12 months), the cost will add up. My questions are: [*]Is it possible to assign a setup cost? [*]How can I make it so that, while some things will be, say $2 a month, others will be $3 or other amounts? Here's what I have so far, to try and figure this out. Feel free to laugh... Or if you could point me to an example of something like this, I'd be very appreciative! Thanks!! function ChangeInitialCost(){ $cic = ($_POST['newpremium']); if (($cic == "clan") || ($cic == "guild") || ($cic == "house") || ($cic == "militia")){ } And the form I have: (I haven't entered a submit button yet...) <table width="200" border="1"> <form action="premium.php" method="post" name="purchase"> <tr> <td>Premium:</td> <td><select id="newpremium" name="newpremium"> <option value="casino">Casino</option> <option value="clan">Clan</option> <option value="guild">Guild</option> <option value="house">House</option> <option value="militia">Militia</option> </select></td></form> </tr> <tr><form action="premium.php" method="post" name="length"> <td>Length:</td> <td><select id="length" name="length"> <option value="0">-----</option> <option value="1">One Month</option> <option value="2">Two Months</option> <option value="3">Three Months</option> <option value="4">Four Months</option> <option value="5">Five Months</option> <option value="6">Six Months</option> <option value="7">Seven Months</option> <option value="8">Eight Months</option> <option value="9">Nine Months</option> <option value="10">Ten Months</option> <option value="11">Eleven Months</option> <option value="12">Twelve Months</option> </select></td></form> </tr> <tr> <td>Cost:</td> <td>SOME TYPE OF FUNCTION</td> </table>
  2. I tried this option: <?php //example result $row['class']="2"; $classes=array("Select","All","Alchemist","Assassin","Dark Arts","Dark Paladin","Entertainer","Hunter","Mage","Monk","Paladin","Pirate","Priest","Psion","Scholar","Thief","Warlock","Warrior"); echo "<tr><td width=\"20%\">Class:</td><td><select name=\"class\">"; foreach ($classes as $k => $v){ echo "<option value=\"$k\"" . ($row['class']=="$k" ? ' selected="selected"' : '') . ">$v</option>"; } echo "</select></td></tr>"; ?> ... But I'm getting an error on the $row['class']="2"; line. Error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING I don't see why that is an error...
  3. I can't really give it a default, as this is the general code for all items. So, if I give something a general default of a different option, it will mess up all the other items. Is there something I can use other than SELECT that might work?
  4. Okay, so, here's my dilemma. I'm wanting to have it so someone can edit an item in the database, but it is a dropdown menu for the options to choose from. How do I make it so that the option that the item currently is is what the default showing is? For instance, if the item is for a "warrior", it will show warrior already in the dropdown menu. However, I could go to the dropdown menu and select a different option if I wanted. The {{class}} doesn't seem to give that default. Right now, it just defaults to "All" regardless of what the item truly goes to, such as "warrior". Thanks in advance!! Here's what I have for the coding: <tr><td width="20%">Class:</td><td><select name="class" value="{{class}}"> <option value="1" {{class1select}}>All</option> <option value="2" {{class2select}}>Alchemist</option> <option value="3" {{class3select}}>Assassin</option> <option value="4" {{class4select}}>Dark Arts</option> <option value="5" {{class5select}}>Dark Paladin</option> <option value="6" {{class6select}}>Entertainer</option> <option value="7" {{class7select}}>Hunter</option> <option value="8" {{class8select}}>Mage</option> <option value="9" {{class9select}}>Monk</option> <option value="10" {{class10select}}>Paladin</option> <option value="11" {{class11select}}>Pirate</option> <option value="12" {{class12select}}>Priest</option> <option value="13" {{class13select}}>Psion</option> <option value="14" {{class14select}}>Scholar</option> <option value="15" {{class15select}}>Thief</option> <option value="16" {{class16select}}>Warlock</option> <option value="17" {{class17select}}>Warrior</option> </select></td></tr>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.