Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

refresh page when checkbox is checked

Status
Not open for further replies.

tyrannus

MIS
Apr 6, 2006
115
US
I have an app that I am developing, it is in php and it queries a database and displays the info in an html table with a checkbox at the end of each row. What I want to do is use javascript to refresh the page passing a couple variables in the url so that when the page refreshes I can use php to update the database.
 
have you tried
Code:
document.location.href='mydomain.com/mypage.php?var1=val1&var2=val2';

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
That doesn't work, when I check the box it does nothing.
 
show us what code you have, we are all stabbing in the dark without knowing what you have

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Duh, should have thought to post the code.. here it is in its entirety.

Code:
<?php
session_start();
require 'include.php';


 $qrr = "select * from script_stat where email = '$email' and processed = 'N' and scriptstat = 'Y'";
 $qr2 = mysql_query($qrr) or die(mysql_error());

 $qu = "select * from users where email= '$email'";
 $q1 = mysql_query($qu) or die(mysql_error());
 $row1 = mysql_fetch_array($q1);

?>

<html>
 <title>
  Requests for <?php echo $row1['fname'] .' '.$row1['lname']; ?>
 </title>


<body>
<table border = 2>
 <tr>
  <td>Rx Number</td>
  <td>Patient First Name</td>
  <td>Processed</td>
 </tr>
<?php
  while($row3 = mysql_fetch_array($qr2)){
   echo '<tr><td><font size = 4>'.$row3['scriptnum'].'</td><td> '.$row1['fname'].'</font></td><td> <input type = checkbox value = Y name = checked onclick="document.location.href=[URL unfurl="true"]https://shopfagen.com/rxrefill/adm1/request.php?process='.$checked.'&scriptnum='.$row3[/URL]['scriptnum'].'"><br>';
 }
?>
</table>
To go back <a href = main.php>Click Here</a>
</html>
 
works fine for me, check out my test page.


"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
I will tinker with it, not sure why it is not working. Wouldn't be because I am using PHP to output would it?
 
when do you want to refresh the screen? on what action? what data do you want to pass through? you need to be more specific if you want anybody besides 1DMF to help.



*cLFlaVA
----------------------------
[tt]"quote goes here"[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
I want it to refresh the screen when I check the box and it passes the two variables on the url process and scriptnum. When the page reloads, a query in php will then execute and change the value of a field in the database to a Y. I haven't written that part yet as I am trying to get it to reload and pass the arguments on the url
 
are process and scriptnum unique to the form, or is there a process and scriptnum for each row? please remember: we've never seen your site before, nor do i want to read through the PHP code you've provided (this is a client-side forum, PHP is a different forum) to determine what it is you're doing.



*cLFlaVA
----------------------------
[tt]"quote goes here"[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
I got it working, I forgot in PHP a single ' has special meaning and if I want to use the absolute meaning of ' I need to write it as \' so it is working now
 
i was going to suggest if you needed to escape and quotes. Glad you got it working.

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top