Jump to content

Make a Link Execute a Script?


chaseman

Recommended Posts

Seems to be a basic question, but I couldn't find an answer nor figure it out on my own.

 

Basically I have a script that takes out specific data out of the database, the script works on its own, now I just need a way to make the user execute it with a link or a button.

 

Example:

Category: [smileys] - [Category2] - [Category3] - etc.

 

As soon as the user clicks on [smileys] all data in the database which contains the word smileys in the category field gets selected and outputted as a list.

 

Again the script works, I just need to be able to execute it with a button.

 

If I understood it correctly I have to run the script by adding a

if (isset($_POST['Smileys'])) {

in front of the script.

 

But how do I build the connection with the text link?

Link to comment
Share on other sites

A simple example....

 

function smileys() {
  echo "In here you would have your sileys code";
}

if (isset($_GET['action'] && $_GET['action'] == 'smileys') {
  smileys();
}

echo '<a href="?action=smileys">Execute Smileys</a>';

Link to comment
Share on other sites

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.