Ghost
Ghost

Reputation: 1

fetch data from database where url=$url

I have trouble to fetch data where url=$url I have successful store data with url and now want to fetch these data on the base of url . I means if I have a form when user filled form and submit I receive all info in database with url . For example when user fill the form on this page http://test.pricemoment.com/test.php I get url /test.php in the database.

Now I want to fetch all data that was filled by users in this page bellow the form.

NOTE: I have many pages How to fetch data that was submitted on specific page using url from database

for example when user visit this page http://test.pricemoment.com/test.php How to fetch all data that was submitted by users on this page ..

form code is

<div class="form-group replyin">
 <form method="post" action="'.$_SERVER['REQUEST_URI'].'" id="foo">
<input type="hidden" name="tm" value="'.time().'"/>
<input type="hidden" name="uri" value="'.$_SERVER['REQUEST_URI'].'"/>
<input type="hidden" name="id" id="id" value="0"/>
 <div class="form-group">
      <input type="text" class="form-control" id="name" name="name" required placeholder="Name...">
  </div>

  <div class="form-group">
       <input type="text" class="form-control" id="email" name="email" required placeholder="Email...">
   </div>

   <div class="form-group">
      <textarea class="form-control" id="comment" name="comment" row="5"  required placeholder="Add a public comment..."></textarea>
  </div>
  <div class="form-group">
      <button type="submit" class="btn btn-info" id="submit">Comment</button>
  </div>
</form>
  </div>

Upvotes: 1

Views: 561

Answers (1)

Ashish Ranade
Ashish Ranade

Reputation: 605

I think instead of storing the data along with the URL, you should create a column into the database name "page_name" and pass the hidden field from you each form which states its name, and save that name against the "page_name" column, so that you can precise fetch the data from DB, like select * from your table_name where page name = ''; or you can use like query which ever suits you. lets us know if I misjudge your approach of saving data. Happy coding :)

Upvotes: 1

Related Questions