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 Quote 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? Quote 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 Quote 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? Quote 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 Quote 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. Quote 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 Quote 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? Quote 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. Quote 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. Quote 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? Quote 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? Quote 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? Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.