Jump to content

php sending vars


jonniejoejonson

Recommended Posts

Okay I don’t want the code just an explanation how to do this:

Imagine I have a social network website.

I have a page ‘displayFriends.php’ that displays a users friends.

By the name of each listed friend is a delete button…

If a user clicks the delete button… how do I send the necessary variables to ‘deleteFrined.php’ without the user having to leace the page… or if they do have to leave th page then return to the page.

 

i.e. how do you send vars to a php page without that page loading. Many thanks to any responders J

Link to comment
Share on other sites

without that page loading?

 

well thats not possible with php, you will have to use AJAX for that.

 

If you want to solved this you should send the data with a form to deletefriend page and then in deletefriend page redirect the user to displayfriends, when its done deleting. The user will never notice that he/she is forwarded to deletefriend.

 

But again, use AJAX if you dont want the site to refresh.

Link to comment
Share on other sites

asmith means:

<?php
if (!$_POST['delete'])
{
//code for deleting friend.
}
else
{
// code for displaying friends.
}
?>

It's pretty simple....

 

This solution I believe is what you are looking for - you design the page to see if the user clicked the Delete button for that friend and run the delete script if so. (Did you make the delete button a link or a submit button? Can you send POST values using links?

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.