943,152 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 927
  • PHP RSS
You are currently viewing page 1 of this multi-page discussion thread
Feb 3rd, 2010
-2

need ur help hurry....

Expand Post »
I have a form with 2 textboxs. with js handling

PHP Syntax (Toggle Plain Text)
  1. <script type = "text/javascript">
  2. function autofill(which) {
  3. document.getElementById("text2").value = which;
  4. }
  5. </script>
  6. <input type="text" name="text1" onblur="autofill(this.value)" />
  7. <input type="text" name="text2" />

So According the above js, when user type some thing on text1 text box automatically update it to the text2 text box...

My question is how I handle this case by php..?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
umandajayo is offline Offline
45 posts
since Feb 2010
Feb 3rd, 2010
1
Re: need ur help hurry....
Do you mean $_POST['text1']=$_POST['text2']; ?
Sponsor
Featured Poster
Reputation Points: 410
Solved Threads: 258
Occupation: Genius
cwarn23 is offline Offline
3,003 posts
since Sep 2007
Feb 3rd, 2010
0
Re: need ur help hurry....
Click to Expand / Collapse  Quote originally posted by cwarn23 ...
Do you mean $_POST['text1']=$_POST['text2']; ?
No i need it like auto filing... hera this is my complete code
PHP Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3.  
  4. <title>txt with js eff</title>
  5. </head>
  6.  
  7. <body>
  8. <script type = "text/javascript">
  9. function transfer(which) {
  10. document.getElementById("temp_name").value = which;
  11. }
  12. </script>
  13.  
  14. <form action="" method="post" name="register">
  15. <label> In put 1 </label><input type="text" name="username" id = "username" onkeyup = "transfer(this.value)"><br><br />
  16.  
  17. <label> In put 2 </label><input type="text" name="temp_name" id = "temp_name">
  18. </form>
  19. </body>
  20. </html>

try this code and you can see what is happening to "Input 2" while typing on "In put 1" I need to handle it by php...!
can you help me....?
If can Im so appreciate...
Reputation Points: 10
Solved Threads: 0
Light Poster
umandajayo is offline Offline
45 posts
since Feb 2010
Feb 3rd, 2010
0
Re: need ur help hurry....
nothing happens with PHP until you do a submit.
JS is what you want for "real time" effects.
Once the page is rendered, PHP has already done what it is going to do.
Perhaps you want to echo the results back after submit?
I'm not clear as to what you are trying to accomplish.
JRM
Reputation Points: 130
Solved Threads: 75
Practically a Master Poster
JRM is offline Offline
618 posts
since Oct 2006
Feb 3rd, 2010
0
Re: need ur help hurry....
Do you mean autofilling or autofiling (files)?? I assume you mean the former. You're transferring the contents of the first input box to the next 'as you type', correct? Code seems fine and dandy to me. Why on earth do you need pHp? You can't use pHp to do anything that js can't in this situation. If you're thinking of using Ajax - nope - js again. You're stuck with JS. Rule of thumb - if you want the PAGE to react to the user's actions - it's JS (or Ajax).

As mentioned, php is done, through, finito, caput, once it's sent to the client - the client just accepts html - it is not aware that it was produced by php. Well, pretty much anyway.
Last edited by ardav; Feb 3rd, 2010 at 10:45 am.
Sponsor
Featured Poster
Reputation Points: 1041
Solved Threads: 935
Sarcastic Poster
ardav is offline Offline
6,620 posts
since Oct 2006
Feb 3rd, 2010
0
Re: need ur help hurry....
Quote ...
My question is how I handle this case by php..?
I received your pm and as ardav explained, php does not really have any involvement in this situation. Also I tested your script and it works like it should. So what is your script not doing as it does exactly what you describe you want it to do?
Sponsor
Featured Poster
Reputation Points: 410
Solved Threads: 258
Occupation: Genius
cwarn23 is offline Offline
3,003 posts
since Sep 2007
Feb 4th, 2010
0
Re: need ur help hurry....
Im so appreciate and happy about your kindly replies... OK I need to pass "In put 1" value to "In put 2".. if u have any suggestions or code to do this plz make a note....

Thank you...
Umanda
Last edited by umandajayo; Feb 4th, 2010 at 11:06 pm.
Reputation Points: 10
Solved Threads: 0
Light Poster
umandajayo is offline Offline
45 posts
since Feb 2010
Feb 4th, 2010
0
Re: need ur help hurry....
Maybe something like this?
But it still requires a submit...
PHP Syntax (Toggle Plain Text)
  1. <?php
  2. if(isset($_POST['submit'])) {
  3. $valueB = ' value="' . $_POST['valueA'] . '"';
  4. }
  5. ?>
  6. <html>
  7. <body>
  8. <input type="text" name="inputA" />
  9. <input type="submit" name="submit" value="GO" />
  10. <br /><br />
  11. <input type="text" name="inputB"<?php echo $valueB; ?>>
  12. </body>
  13. </html>
Last edited by Jerail; Feb 4th, 2010 at 11:13 pm.
Reputation Points: 11
Solved Threads: 5
Light Poster
Jerail is offline Offline
39 posts
since Feb 2010
Feb 4th, 2010
0
Re: need ur help hurry....
Click to Expand / Collapse  Quote originally posted by ardav ...
Do you mean autofilling or autofiling (files)?? I assume you mean the former. You're transferring the contents of the first input box to the next 'as you type', correct? Code seems fine and dandy to me. Why on earth do you need pHp? You can't use pHp to do anything that js can't in this situation. If you're thinking of using Ajax - nope - js again. You're stuck with JS. Rule of thumb - if you want the PAGE to react to the user's actions - it's JS (or Ajax).

As mentioned, php is done, through, finito, caput, once it's sent to the client - the client just accepts html - it is not aware that it was produced by php. Well, pretty much anyway.
You are correct..! I need transferring the contents of the first input box to the next when I Focus my curser to next input box(input box 2).. I need to do it by using pHp..if u have any sugection o code plz let me to know

Thank you
Reputation Points: 10
Solved Threads: 0
Light Poster
umandajayo is offline Offline
45 posts
since Feb 2010
Feb 4th, 2010
0
Re: need ur help hurry....
Click to Expand / Collapse  Quote originally posted by Jerail ...
Maybe something like this?
But it still requires a submit...
PHP Syntax (Toggle Plain Text)
  1. <?php
  2. if(isset($_POST['submit'])) {
  3. $valueB = ' value="' . $_POST['valueA'] . '"';
  4. }
  5. ?>
  6. <html>
  7. <body>
  8. <input type="text" name="inputA" />
  9. <input type="submit" name="submit" value="GO" />
  10. <br /><br />
  11. <input type="text" name="inputB"<?php echo $valueB; ?>>
  12. </body>
  13. </html>
Thank your reply...did you test this code on your pc...? Ops...! I struggling...It is not working...I mane no any visible function to see.....
Reputation Points: 10
Solved Threads: 0
Light Poster
umandajayo is offline Offline
45 posts
since Feb 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: str_replace woes
Next Thread in PHP Forum Timeline: Automatic email reminder by php script





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC