Hi
I would like the following action to happen without having to have a 'submit' button. This would avoid users having to go from one page to a second page and the action could just happen on the first page by clicking on the word?
How could it be done?

many thanks...

<?php require_once('Connections/xxxxxxxxx_localhost.php'); 
      require_once('myaccess/appvars.php');

// Connect to the database
  $dbc = mysqli_connect("localhost", "xxxxxxxxx", "xxxxxxxx", "xxxxxxxxx");
  
  if (isset($_POST['submit'])) {
  $prop_renew = mysqli_real_escape_string($dbc, trim($_POST['prop_renew']));
  $prop_id = mysqli_real_escape_string($dbc, trim($_POST['prop_id']));
  
  
  // Connect to the database
  $dbc = mysqli_connect("localhost", "xxxxxxxx", "xxxxxxxxx", "xxxxxxxxx");
  
	  $query = "UPDATE DEV_property_details SET
	  add_date = NOW(),
	  prop_renew = 'renewed'
	  WHERE prop_id = '$prop_id' LIMIT 1";
  
  mysqli_query($dbc, $query);
 
mysqli_query($dbc, $query);
// Confirm success with the user?>

<table width="675" border="0" align="center" cellpadding="0" cellspacing="0" class="maintext">
        <tr>
          <td width="155" class="maintextbold">Your property has been successfully renewed. You can view your properties <a href="../view_property_record.php">here</a>. Alternatively please return to your expired properties <a href="../view_expire_record.php">here</a> </td>
                  </tr></table>

<?php
		
		mysqli_close($dbc);
		exit();
          }
      
   else { 
   ?>
   
  <table width="675" border="0" align="center" cellpadding="0" cellspacing="0" class="maintext">
        <tr>
          <td width="155" class="maintextbold">Please click on 'Confirm Renewal' to renew your property.  It will immediately be visible on the site.</td>
                  </tr></table> 
   <?php  
 
    }  
		
		
		  ?>

Hi Thanks for getting back to me.

I'm not familiar with ajax but have eventually done it like this:

<?php if ($row_rs_propdetails ['ID'] == $_SESSION['ID']&& ($row_rs_propdetails ['status'] == "Removed")) {
					?> 
                    <a href="?run=add_shortlist&amp;recordID=<?php echo $_GET['recordID']?>">Add To Shortlist</a>
					<?php } ?>

Many thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.