PC Nerd Posted January 7, 2007 Share Posted January 7, 2007 if i was to start passing information from page to page using the $_POST array, can javascript read these arrays, or qould it have to read on the server, and given to javascript as text input??? Quote Link to comment Share on other sites More sharing options...
trq Posted January 7, 2007 Share Posted January 7, 2007 Yes and yes. Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted January 7, 2007 Author Share Posted January 7, 2007 1. how2. what the code to edit the $_POST array ie add entries to it Quote Link to comment Share on other sites More sharing options...
tomfmason Posted January 7, 2007 Share Posted January 7, 2007 javascript could access a forms values prior to being posted but I really don't think that there is anyway that you would access any type of post array with javascript.. Since the post is made to the serverside.. This may have to be done with ajax or JSON.. Now I know that you could use the current url to parse information.. Which would basically be like php's $_GET.. here is a post of mine that may help with that.. http://www.phpfreaks.com/forums/index.php/topic,111729.msg452963.html#msg452963[b]edit[/b]You could just use cookies.. You can set and read them with javascript.. So unless the information being passed needs to be secure I think that cookies would be the best way to go.. Good Luck,Tom Quote Link to comment Share on other sites More sharing options...
trq Posted January 7, 2007 Share Posted January 7, 2007 When you asked 'can Javascript read these arrays?', I assumed you meant can Javascript variables be populated with this data? And the answer is yes, you can populate a javascript variable (or an array) with data posted via post just as easily as populating a html <p></p> tag.You'll need to bne allot clearer in what exactly it is your trying to do. Quote Link to comment Share on other sites More sharing options...
fenway Posted January 7, 2007 Share Posted January 7, 2007 You could always have PHP write out a JS array, but of course, that's meaningless for POST data. Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted January 7, 2007 Author Share Posted January 7, 2007 ok, thanks for yourhelp everyone. ill let you know if i need anymore help Quote Link to comment 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.