FishSword Posted April 11, 2010 Share Posted April 11, 2010 Hi, How would I go about populating an array through anchors (<a>)? I have several links that contain people names, and I want to put these into an array upon the user clicking them. The data inside the array will not always be the same, it all depends on what names the user clicks on. If you require more information, please let me know! Cheers Link to comment https://forums.phpfreaks.com/topic/198199-populate-an-array-via-anchorshyperlinks/ Share on other sites More sharing options...
FishSword Posted April 11, 2010 Author Share Posted April 11, 2010 ...any ideas? Link to comment https://forums.phpfreaks.com/topic/198199-populate-an-array-via-anchorshyperlinks/#findComment-1039966 Share on other sites More sharing options...
dragon_sa Posted April 11, 2010 Share Posted April 11, 2010 perhaps using Ajax to load the names into a session or cookie that could then be accessed without the need to reload the page Link to comment https://forums.phpfreaks.com/topic/198199-populate-an-array-via-anchorshyperlinks/#findComment-1039968 Share on other sites More sharing options...
FishSword Posted April 11, 2010 Author Share Posted April 11, 2010 Is it not possible to do this with just PHP? Link to comment https://forums.phpfreaks.com/topic/198199-populate-an-array-via-anchorshyperlinks/#findComment-1039979 Share on other sites More sharing options...
teamatomic Posted April 11, 2010 Share Posted April 11, 2010 ?item[1]=this&item[2]=that&item[3]=those HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/198199-populate-an-array-via-anchorshyperlinks/#findComment-1039983 Share on other sites More sharing options...
FishSword Posted April 11, 2010 Author Share Posted April 11, 2010 is it not possible to use POST? - I'd rather hide the information that is displayed in the URL. Link to comment https://forums.phpfreaks.com/topic/198199-populate-an-array-via-anchorshyperlinks/#findComment-1039991 Share on other sites More sharing options...
teamatomic Posted April 11, 2010 Share Posted April 11, 2010 No, to post data you need a form. You can make a form for each "link" that will post the data you want to use. Then instead of a button use a text link with javascript to submit the form. HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/198199-populate-an-array-via-anchorshyperlinks/#findComment-1040004 Share on other sites More sharing options...
FishSword Posted April 11, 2010 Author Share Posted April 11, 2010 is there any other way to do it, as I don't really won't the data to be in the URL? Link to comment https://forums.phpfreaks.com/topic/198199-populate-an-array-via-anchorshyperlinks/#findComment-1040015 Share on other sites More sharing options...
teamatomic Posted April 11, 2010 Share Posted April 11, 2010 Read #6 again. Use a form. Link to comment https://forums.phpfreaks.com/topic/198199-populate-an-array-via-anchorshyperlinks/#findComment-1040020 Share on other sites More sharing options...
FishSword Posted April 11, 2010 Author Share Posted April 11, 2010 How would I go about utilizing the form idea. The coding bit is what puzzles me. Link to comment https://forums.phpfreaks.com/topic/198199-populate-an-array-via-anchorshyperlinks/#findComment-1040028 Share on other sites More sharing options...
RichardRotterdam Posted April 11, 2010 Share Posted April 11, 2010 Since it has been moved to javascript have you considered javascript for this at all? Link to comment https://forums.phpfreaks.com/topic/198199-populate-an-array-via-anchorshyperlinks/#findComment-1040110 Share on other sites More sharing options...
FishSword Posted April 11, 2010 Author Share Posted April 11, 2010 I'd rather not use JavaScript. Can't this just be done using PHP? Link to comment https://forums.phpfreaks.com/topic/198199-populate-an-array-via-anchorshyperlinks/#findComment-1040116 Share on other sites More sharing options...
RichardRotterdam Posted April 11, 2010 Share Posted April 11, 2010 Showing nothing at all in the url and using hyper links is not possible with PHP alone. Is it required to have these names in hyperlinks specific? Is there perhaps another purpose for this page with clickable names other then putting values in an array? Link to comment https://forums.phpfreaks.com/topic/198199-populate-an-array-via-anchorshyperlinks/#findComment-1040133 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.