Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Server-side Scripting _ HOW TO CONTROL MULTIPLE BUTTONS REFRESHING INPUT VALUES

Posted by: shankar from vizag May 11 2019, 08:49 AM

Greetings,

I am having two php pages. 1) filesearch.php 2)filedelete.php

filesearch.php is attached.

<!--filedelete.php contains the following -->
<?php
$link = mysqli_connect("localhost","root","");
mysqli_select_db($link,"stores_bgts");

$id = $_GET['id'];
$q = "DELETE FROM `filetrack` WHERE id = $id";
mysqli_query($link,$q);
header('location:filesearch.php');

?>

In filesearch.php, I had 3 buttons, one is search and the other two are delete and update. while clicking search button, somehow with an input attribute I manage to display input values after search button click. Whereas, clicking on any of the delete, update refreshing the input values. I just want to display the remaining records searched after deleting the opted record. But the delete query executing and redirecting to filesearch.php and there all records searched are refreshed. Kindly guide me to fix this issue. Thanks in advance.


Attached File(s)
Attached File  filesearch.php ( 3.52k ) Number of downloads: 217

Posted by: pandy May 11 2019, 05:30 PM

I MOVE THIS TO THE SERVER-SIDE SCRIPTING FORUM.

Posted by: CharlesEF May 12 2019, 08:55 PM

I 'think' you want to display the original search results after clicking on delete or update button instead of doing a new search, which is what is happening now.

Do I understand correctly?

Posted by: shankar from vizag May 12 2019, 09:32 PM

QUOTE(CharlesEF @ May 13 2019, 07:25 AM) *

I 'think' you want to display the original search results after clicking on delete or update button instead of doing a new search, which is what is happening now.

Do I understand correctly?


exactly.

after redirection from filedelete.php, all input values and search items disappearing. It should not happen.

Posted by: shankar from vizag May 13 2019, 07:43 AM

Greetings.

in detail,

my filesearch.php has 3 buttons.

1. search
2. delete
3. update

the following portion, retaining the input values even after displaying the search items after pressing the search button
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$frmdate=$_POST['frmdate'];
$todate=$_POST['todate'];
?>
</select>
<input type="text" id="myDatepicker" placeholder="Click to pick from date" name = "frmdate" autocomplete="off" value="<?php if(isset($frmdate)) {echo $frmdate;}?>"/> <input type="text" id="myDatepicker2" placeholder="Click to pick to date" name = "todate" autocomplete="off" value="<?php if(isset($todate)) {echo $todate;}?>"/> <br>
<br><input name="search" class="btn btn-primary" type="submit" value="SEARCH"/></center>
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

after clicking either delete / update buttons, the code is executing but all the content on the screen disappearing. Kindly guide me in this regard to overcome the issue.

Posted by: CharlesEF May 13 2019, 09:49 PM

Sorry for the delay, I've been out all day. I'll have to look over your code to be sure. It sounds like after you click on the update or delete button, and the code runs, then you are taken back to the main page, in this case the search page. Now the search page comes up blank but you want the original search done again. Is this correct?

If I'm understanding correctly then why not just pass 'frmdate' and '$todate' in the URL. Then rewrite your search code to check for the $_GET values. If found do the search and show the results. If not found then display the empty search page.

Posted by: shankar from vizag May 13 2019, 10:35 PM

QUOTE(CharlesEF @ May 14 2019, 08:19 AM) *

Sorry for the delay, I've been out all day. I'll have to look over your code to be sure. It sounds like after you click on the update or delete button, and the code runs, then you are taken back to the main page, in this case the search page. Now the search page comes up blank but you want the original search done again. Is this correct?

If I'm understanding correctly then why not just pass 'frmdate' and '$todate' in the URL. Then rewrite your search code to check for the $_GET values. If found do the search and show the results. If not found then display the empty search page.


Thank you so much charles. I will try and get back here with the result. Once again thank you so much for the support.
regards

Posted by: shankar from vizag May 14 2019, 09:26 AM

QUOTE(CharlesEF @ May 14 2019, 08:19 AM) *

Sorry for the delay, I've been out all day. I'll have to look over your code to be sure. It sounds like after you click on the update or delete button, and the code runs, then you are taken back to the main page, in this case the search page. Now the search page comes up blank but you want the original search done again. Is this correct?

If I'm understanding correctly then why not just pass 'frmdate' and '$todate' in the URL. Then rewrite your search code to check for the $_GET values. If found do the search and show the results. If not found then display the empty search page.



Tons of thanks to CHARLES ji for your wonderful guidance.

Problem solved.

regards

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)