Hi Guys
I have been all over the web searching for an answer. Hope someone can help me.
I have a script with the following:

$total_crt //total available credits (taken from mysql database using php)
$credit // Display an ad credit. (also stored in mysql database using php)
select dropdown box (amount) // New values to be added.

I need to do the following:
When the amount boc changes value, it must change the $credit amount and effect the $total_crt amount (ex. 10 + 10 in credit value - $total_crt value)
So whenever the client chooses a new value from the select box, it must change it emidiately with javascript, but only send to the database once an update button is pressed.

Here is a quick example of my code:


$total_crt = $row2['total_crt']; //displays total available credit

<TD>R<?php echo $credit //Displays ad credit?></TD> 

<td><select name=\"amount\">
<option value="10">10</option>
<option value="20">20</option>
<option value="30">30</option>
<option value="40">40</option>


Hope that someone can help me with this.

Recommended Answers

All 3 Replies

Hi Shanti
I am not a java ot Ajax programmer. I dont know how it works and am gonna need some help.
If I have a php string like '$value' already set with a value. How can I pull this value in to use it in Ajax and then to add the value of the dropdown to it?
Please help me here, I really dont know where to start with this problem.

Hi Guys
I found something that kinda worked on the following URL:

I have just a small question now regarding the dropdown. I am sure its related to an 'id'.
Here is my script:

<td><?php echo "<select name=\"field1\" class=\"qty\" onchange=\"calcTotal();\">"; ?>
echo '<option value="'.($i+$credit).'">'.$i.'</option>';

Currently its adding all fields in my dropdown value to the first box.
I currently have 2 table rows for testing.

How can I tell this script to add each rows values separately?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.