dfalkowitz Posted July 26, 2011 Share Posted July 26, 2011 Is there a way to call a PHP database within a *.html page and populate the answer to a hidden field? For example: SQL DB has 2 fields ID and SEGMENT, ID SEGMENT 1 A 2 B 3 C 4 D I have a form: <form action="Untitled-2.php" method="post" name="form1" id="form"> <input type="radio" name="ID" value="4" /> 4</label> <label> <input type="radio" name="ID" value="3" /> 3</label> <label> <input type="radio" name="ID" value="2" /> 2</label> <label> <input type="radio" name="ID" value="1" /> 1</label> <input name="segment" id="segment" type="hidden" /> I want to be able to have a button onclick() go out the the php server collect which Segment it is and populate the hidden text field "segment" then submit all on the same HTML page? Quote Link to comment Share on other sites More sharing options...
WebStyles Posted July 26, 2011 Share Posted July 26, 2011 you can do it with AJAX, but what is the point? since you're going to submit the form anyway, why do you need the segment in a hidden field before hand? Quote Link to comment Share on other sites More sharing options...
dfalkowitz Posted July 26, 2011 Author Share Posted July 26, 2011 It's complicated - I am using a 3rd party app... How would I do it in AJAX? I have used it before but not that familiar with it... Thanks for the response! Quote Link to comment Share on other sites More sharing options...
WebStyles Posted July 26, 2011 Share Posted July 26, 2011 better to have a look in the ajax forum, but basically you want to use javascript to create an http_request, and then write the result to the hidden form field. There are many examples. try google for a quick fix. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.