php/javascript

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nite4000
Forum Contributor
Posts: 209
Joined: Sun Apr 12, 2009 11:31 am

php/javascript

Post by nite4000 »

hey everyone i have a problem.

First task is i have a form that get teh value from the db that works find and it automatically input the value into the text box but my problem is I have another box that is used for the length like if they wanna purchase 4 weeks then they would enter 4


that box is called multiplier

the box that value should show in is amt

now all this is determined by the selection of the drop box

however i need to have it take the value of the multiplier and multiply it by the amount thats in the amt box and have it show the new amount in amt box.

i know there is serveral ways to do this but i need it to have the correct amount before proceeding.

Here is my code for the form and you will see the javascript code

Code: Select all

<form action="advertise.php" method="post" name="theform" onchange="CheckForm()">
<table>
  <tr><td colspan="2">Special Banner(728 * 90)</td></tr>
  
  <tr><td width="190">Choose Postion</td><td width="568">
  <select name="pos" onchange="document.theform.amt.value=this.value">
  <option value="">Choose Postition</option>
  <?php
  list($top_ban_show) = mysql_fetch_row(mysql_query("SELECT top_ban_show FROM general_settings")) or die(mysql_error()); $query = "SELECT id,w_cost,m_cost FROM banners_728 WHERE url = '' AND id <= $top_ban_show";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result))
{
    echo "	<option value=\"{$row['w_cost']}\">{$row['id']}</option>";
}
?>

</select>




  </td></tr>
  <tr>
    <td>Banner URL</td><td><input name="ban_url" type="text" size="60" maxlength="60" /></td></tr>
  <tr>
    <td>Ad Duration</td><td><input name="multiplier" type="text" size="3" maxlength="3" /><input type="radio" name="timeframe" value="weeks" checked="checked" />
      Weeks<input type="radio" name="timeframe" value="months" />Month(s)</td></tr>
  <tr>
    <td>Target Website Url :</td>
    <td><input name="url" type="text" size="60" maxlength="60" id="tar_url" /></td>
  </tr>
  <tr>
    <td>Alternate Text :</td>
    <td><input name="alt" type="text" size="60" maxlength="60" id="alt" /></td>
  </tr>
  <tr>
    <td>Description :(160 Charcters)</td>
    <td><textarea name="desc" cols="60" rows="3" id="desc"></textarea></td>
  </tr>
  <tr>
    <td><p>Advertiser Email Address :</p></td>
    <td><input name="email" type="text" size="60" maxlength="60" id="email" /></td>
  </tr>
 <tr>
    <td><p>Pay this much :</p></td><td><input name="amt" type="text" size="5" maxlength="5" id="amt"  /></td></tr>
<tr><td colspan="2"><input type="submit" value="Continue" name="next" /></td></tr>
  
</table>
</form>
anyone to give insight of how to make the js code work would help alot.

Thanks
Post Reply