By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,044 Members | 1,172 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,044 IT Pros & Developers. It's quick & easy.

parsing a value from a text box to a url

P: 59
Expand|Select|Wrap|Line Numbers
  1. function parse(){
  2.   me=document.forms[0].regno.value;
  3.   right_window.src="result.php?registration='me'";
  4. }
  5. <html>
  6. <input type="text" name="regno" id="regno">
  7. <input type="button" name="search" id="search" />
  8. </html>
  9.  
Sep 9 '09 #1
Share this Question
Share on Google+
8 Replies


Dormilich
Expert Mod 5K+
P: 8,639
JS is not PHP. variables in strings are not replaced.
Sep 9 '09 #2

P: 59
like you ve most probably observed i am new to JS and more php oriented please what options do i have?
Sep 9 '09 #3

Dormilich
Expert Mod 5K+
P: 8,639
to be blunt, read a tutorial (more in the stickies thread). like when you started with PHP, it is best to get used to the basics of the new language first.
Sep 9 '09 #4

P: 59
ok i improved it but its still not working
Expand|Select|Wrap|Line Numbers
  1. function value(){
  2. reg=this.document.forms[0].regno.value;
  3. parent.document.all.m_display.location.href="studentinfo.php?registrationnumber="+reg;
  4. }
  5.  
am sorry if am not doing this the right way but i have a dead line to submit this project
Sep 10 '09 #5

acoder
Expert Mod 15k+
P: 16,027
Don't use document.all - use document.getElementById() to refer to elements. Check whether parent is really what you're after - do you want to change the URL of the main page from a frame?
Sep 10 '09 #6

Dormilich
Expert Mod 5K+
P: 8,639
location is a property of either document or window. to load a new page you need to call it as
Expand|Select|Wrap|Line Numbers
  1. location.href = new_URI;
Gecko browsers may let you use
Expand|Select|Wrap|Line Numbers
  1. parent.document.location.href = new_URI;
probably the best would be to pass the value to the other window and do location.href there. but as acoder mentioned, it depends on your project.
Sep 10 '09 #7

P: 59
Am not changing the main window
the frame set contains 3 frames the top for designs, the left frame is for users to search for students,schools,teachers etc and depending on what they re searching for the right window displays a document i have written to get the result of their search
Sep 10 '09 #8

Dormilich
Expert Mod 5K+
P: 8,639
that layout could also be achieved by not using frames, which probably would lift some of the trouble.
Sep 10 '09 #9

Post your reply

Sign in to post your reply or Sign up for a free account.