I have a bunch of drop down boxes, then after they are selected the the total amount automatically appears at the bottom.. the only problem is it appeears like this -

<span id="resp">Total</span>

How would I make this insert into the database?
Member Avatar

Save the amount to a textbox or also to a hidden field. Or if you're using ajax (with jQuery), you can pick it up like this:

var total = $('#resp').html();

Can I take a look at more of your code? Then I would feel better suited to give you an answer.

I will try to post some of the code later today.. I tried the hidden but am not getting anything -

<input type="hidden" name="resp" id="resp" />

heres the code.. i just need it to either load into a hidden, or into a text box would work too.. Or if there is a better way of doing this too. calfun.php pulls from a $valuets


function calc()

  if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

  val1 = document.getElementById("price1").value;
  val2 = document.getElementById("price2").value;
  mani = document.getElementById("manipulator").value;

  if (val1 != "" && val2 != "")

  queryPath = "calfun.php?price1="+val1+"&price2="+val2+"&manipulator="+mani;

  if (xmlhttp.readyState==4 && xmlhttp.status==200)





Member Avatar

From what I remember form input fields don't have a innerHtml(). I may be wrong. I've been using jQuery so long, I've lost touch with vanilla js.

I found it out.. it was document.getElementById("test").value = xmlhttp.responseText;

I needed to get rid of the inner.