Jump to content

Textbox onChange, run PHP


RonnieCosta50

Recommended Posts

I have a textbox.  When the text that is typed into the textbox changes, I want to search my database for what is in the textbox.  I want to do this rather than a search button because my website is really complicated and I'm simplifying it in my explanation to make it easy to understand.  I currently have an alert in my textbox that displays the text that was typed in the textbox on change.  It looks like this.

<input name="txtPlayerName" tabindex="0" style="width: 150px; background-color: #BBAE85;" maxlength="15" required="required" autofocus="autofocus" placeholder="LoU screen name" onchange="alert(this.value)" />

I have a seperate php file called search.php.  It contains my code to search the database based on criteria in my input textboxes.

Question:  How do I tell the textbox to run search.php onChange?

Link to comment
https://forums.phpfreaks.com/topic/278706-textbox-onchange-run-php/
Share on other sites

I don't know any AJAX so that option is out the window.  As for submitting the form to search.php... If I submit a form then it will reload the whole website.  I only want it to search the database and display the data into the website without reloading the website.  There are many textboxes and it would not work to reload the page every time a user switches textboxes. 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.