Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9002291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:33:04+00:00 2026-06-16T00:33:04+00:00

I have embeded a button in my web that submits a search. The search

  • 0

I have embeded a button in my web that submits a search. The search value of this form is inputed from a txt file by a php code. The problem I have is that this php code its loaded only once when the webpage loads. This is a problem because the txt file is constantly changing and its content gets read only that first time. So what I want is to make the search value to be inputed when the submit button gets clicked. In other words, I’m looking to make the php code to run and fill the search value onClick.

Here’s the form:

<form id="search" action="http://www.example.com/search.php" method="get" target="_blank">
<input type="hidden" name="search" value="<?php $file = "http://www.clavederock.com.ar/zararadio/CurrentSong.txt";
   $f = fopen($file, "r");
   while ( $line = fgets($f, 1000) ) {
   $line = preg_replace("/-(.*?)-/", "", $line);
   print $line;}?>"/>  
<input type="hidden" name="language" value="es"/>
<input type="image" src="img/psue.png">
</form>

Any suggestion or help will be aprecciated!! Thanks!

EDIT: I see php gets executed before the page is delivered because is server side scripting. To make a workaround this problem, is there a way to make the php code run every x seconds? Like you would make in a div:

 setInterval(function(){
 $('#ID').load('example.php');
 }, 10000);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:33:05+00:00Added an answer on June 16, 2026 at 12:33 am

    You’re going to have to tackle this a different way, PHP is server side scripting (it gets executed before the page is delivered) and JS is client side, which means it gets executed from when the page is delivered to any time when it is displayed.

    You could try and use AJAX, and query the file and change the content in your callback.

    EDIT: I think I understand your question better. You are going to have to use AJAX, and have the PHP code in the file that gets actioned. You can post the input value as a get variable, i.e. ?input=value and then get that in your PHP file. Then use AJAX to get the response back, without reloading the page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have embeded a music in a webpage using this code: <embed src=upload/gnossiennes.mp3 autostart=true
Hi I have a plugin.dll which contains this all npp functions I have embeded
I have one flash file which is embading in another, the embeded one is
I have this simple javascript function which changes the body zoom of the web
I have embedded textfields in cells and I have an edit button that is
I’m trying to have an embedded web site with a button. When I add
I have created a very simple user control ActiveX with a simple button that
I have a web page with some embedded Silverlight. In that Silverlight I have
I have a web application that doesn't run correctly in chrome. Works perfectly in
I have an OS X app that uses a splitview with two embeded NSTableViews.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.