0

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?
3
Contributors
6
Replies
12
Views
5 Years
Discussion Span
Last Post by xbat
0

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();

Edited by diafol

0

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" />
0

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

<script>


function calc()
{

  if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
  else
  {// 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 != "")
  {

  document.getElementById("resp").innerHTML="Calculating...";
  queryPath = "calfun.php?price1="+val1+"&price2="+val2+"&manipulator="+mani;



  xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {

      document.getElementById("resp").innerHTML=xmlhttp.responseText;


    }
  }

  xmlhttp.open("GET",queryPath);
  xmlhttp.send();

  }
}


</script>
0

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.

0

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

I needed to get rid of the inner.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.