jonniejoejonson Posted January 9, 2008 Share Posted January 9, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/85160-php-sending-vars/ Share on other sites More sharing options...
asmith Posted January 9, 2008 Share Posted January 9, 2008 why don't you put deletefriends.php IN displayfriends.php ? then in your form action type the name of displayfriends.php . any click on any button displayfriends.php will load the page again . Quote Link to comment https://forums.phpfreaks.com/topic/85160-php-sending-vars/#findComment-434474 Share on other sites More sharing options...
JJohnsenDK Posted January 9, 2008 Share Posted January 9, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/85160-php-sending-vars/#findComment-434479 Share on other sites More sharing options...
papaface Posted January 9, 2008 Share Posted January 9, 2008 asmith means: <?php if (!$_POST['delete']) { //code for deleting friend. } else { // code for displaying friends. } ?> It's pretty simple.... Quote Link to comment https://forums.phpfreaks.com/topic/85160-php-sending-vars/#findComment-434484 Share on other sites More sharing options...
nikefido Posted January 9, 2008 Share Posted January 9, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/85160-php-sending-vars/#findComment-434599 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.