networkthis Posted June 14, 2008 Share Posted June 14, 2008 Is it possible to call a function as a link in a php document. Example: MyFunction(){ } Link to comment https://forums.phpfreaks.com/topic/110154-functions/ Share on other sites More sharing options...
networkthis Posted June 14, 2008 Author Share Posted June 14, 2008 Ooops.........Accidentaly hit enter and it posted before I was done..... Is it possible to call a function as a link in a php document. Example: ------------------------------------------------------------------ MyFunction() { Do something; } <a href="<?php MyFunction() ?>"> Link on page </a> --------------------------------------------------------------- Will something like that work and perform the function at that point? Link to comment https://forums.phpfreaks.com/topic/110154-functions/#findComment-565304 Share on other sites More sharing options...
DarkWater Posted June 14, 2008 Share Posted June 14, 2008 No, PHP is a server-side language, not client-side. You can use Javascript or Ajax though. Link to comment https://forums.phpfreaks.com/topic/110154-functions/#findComment-565306 Share on other sites More sharing options...
marklarah Posted June 14, 2008 Share Posted June 14, 2008 Just to help you out here, you should use Ajax. Javascript is ONLY client side, where as Ajax is sort of both. Its like a "franken" language. Although in javascript you could have a hidden from input to store stuff, then upon page change, pass it to PHP to do stuff with. Link to comment https://forums.phpfreaks.com/topic/110154-functions/#findComment-565309 Share on other sites More sharing options...
networkthis Posted June 14, 2008 Author Share Posted June 14, 2008 Awesome thank you......now that I am finally getting comfortable with php for the most part-maybe I should start learning ajax...Sounds like I'm going to need it. All these pages are becoming more and more complex. Guess learning ajax can only help. Link to comment https://forums.phpfreaks.com/topic/110154-functions/#findComment-565321 Share on other sites More sharing options...
DarkWater Posted June 14, 2008 Share Posted June 14, 2008 Awesome thank you......now that I am finally getting comfortable with php for the most part-maybe I should start learning ajax...Sounds like I'm going to need it. All these pages are becoming more and more complex. Guess learning ajax can only help. Ajax is basically Javascript. It stands for Asynchronous Javascript and XML. Tell me what you're trying to do so we can tell you of an alternative "just PHP" way to do it. =P Link to comment https://forums.phpfreaks.com/topic/110154-functions/#findComment-565324 Share on other sites More sharing options...
bluejay002 Posted June 14, 2008 Share Posted June 14, 2008 Ajax is truly a nasty thing but don't get too ahead of it... there are some cases where Ajax doesn't really suit at all. Learn Ajax but also learn when to use it. Link to comment https://forums.phpfreaks.com/topic/110154-functions/#findComment-565330 Share on other sites More sharing options...
networkthis Posted June 14, 2008 Author Share Posted June 14, 2008 I have created a file browser system which is becoming more of a file management system. I have a simple setup right now that will allow me to delete each file individually by clicking on a delete icon which is printed by each file. There is also a save icon that is printed by each file. Right now I have to delete each file individually and save each file individually from the file browser. I have now written it so that each file will print out a check box by the file name so that the files can be deleted when checked. along with the save and delete icons for individual file transfer. However, the only way I can figure out to do it is by placing everything inside a form and then sending the values to another page where my delete selected files sciript is run. I was trying to keep from having to use the form buttons on the page. I would like to be able to keep the page looking nice with either icons or by placing the actions in divs with links or so on. I just thought that maybe by there was another way to utilize functions. Just trying to be creative....and kind of tired!!! Thanks for the input so far. Link to comment https://forums.phpfreaks.com/topic/110154-functions/#findComment-565386 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.