Jump to content

Recommended Posts

Hello,

 

I would like to use the same variable on three pages.  Right now I can only get it to work on two.  The first page has a simple HTML form where the variable is entered.  The second page uses the variable just fine.  I am using AJAX to refer to a third page, and I'm not sure how to use the same variable on the third page.  The variable is called "find."

 

On the second page, I have this:

 

$find = strip_tags($find);
$find = trim ($find);
$result=mysql_query("SHOW TABLES FROM sand2 LIKE '%$find%'")
or die(mysql_error());

 

The second page then has AJAX which points to a third page/URL, and on this third page/URL, I have this:

 

function getAllVotes($id)
{
/**
Returns an array whose first element is votes_up and the second one is votes_down
**/
$votes = array();
$q = "SELECT * FROM santafe WHERE id = $id";

 

On the third page, I would like to replace the table "santafe" with the variable "find," the same variable that I use on the second page.  How do I do this?

 

Thanks in advance,

 

John

Well, I guess I should have said I want to make the table name a variable.  On the second page, the table displayed is the one whose name matches the variable "find."  I want to use this same table in the third page that the AJAX points to.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.