-2

I have pasted my code below but can't seem to get it to work. What I'd like to achieve is when someone types something in the username box, I'd like it to echo below, but I'd like the function to check the field every second. Thank you!

Name:  <input type="text" name="username" /><br />

<?php
$username = $_GET['username'];

function functionName() {
echo '<p>ID: ',$username, "</p>";
}
functionName();
?>
Na A
  • 1

2 Answers2

1

PHP isn't the right language to do that, you probably want to look in to javascript to achieve this. Have a look at the question Detecting input change in jQuery?

Community
  • 1
  • 1
Patrick
  • 879
  • 2
  • 11
  • 29
  • Hi Patrick, what I'm actually trying to achieve is to create several input fields, and build a URL e.g. http://www.example.com/id&name&address which I'd like to store temporary as a variable, then use file_get_contents and echo that data onto the page. Would you have any clue, what i'm trying to explain? Thanks :) – Na A Jan 16 '16 at 19:32
  • @NaA Nope, I don't understand what you're looking for. Why do you need it to "call every second" then? – Patrick Jan 16 '16 at 19:53
0

You can implement this on Client Side using Javascript.

If you still want to use server side scripting than you can use Cronjobs.

devpro
  • 16,184
  • 3
  • 27
  • 38