HTML Post problem

Thread Solved

Join Date: Apr 2006
Posts: 20
Reputation: Ries is an unknown quantity at this point 
Solved Threads: 0
Ries Ries is offline Offline
Newbie Poster

HTML Post problem

 
0
  #1
May 17th, 2009
Not sure where to put this as it contains HTML, Javascript and PHP and I can't figure out which one is the problem but because the problem is with an empty POST request I put it here, sorry if that is wrong.

HTML and CSS Syntax (Toggle Plain Text)
  1. <form action="?do=submit" method="post">
  2. <input id="number" readonly="readonly" style="width:7em;"/><br />
  3. <input id="submit" type="submit" style="width: 6em;" value="Generating..." disabled="true"/>
  4. </form>
  5.  
  6. <script type="text/javascript">
  7. function stop() {
  8. var no = document.getElementById("number");
  9. no.value = number;
  10.  
  11. }
  12. </script>
  13.  
  14. <?PHP
  15.  
  16. if ($do == "submit"){
  17. $number = $_POST['number'];
  18. echo $number . " successfully submitted.";
  19. }
  20. ?>

Basically what it is doing is when the user clicks on a element that activates the javascript stop function it sets the value of number to the input fields value (which is set as readonly so the user can not change it.) This part works as the input field shows the value once the function has been executed yet upon submitting the value of $_POST['number'] is null, its empty.

I've looked over this again and again and I can't see what is wrong, the only two things I can think of are:

1) There is a typo/error that I keep overlooking
2) Something with the "readonly" field is affecting the form submit.

Can someone point me in the right direction and explain where I am going wrong.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the HTML and CSS Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC