View Full Version : Need help with some kind of javascript form

10-31-2006, 02:12 PM
I dont know if this can be done or not, but I'm sure it can be.

I have a persay "networking" site, and in profiles there are music players where people have linked to mp3 files. If i have a "Add to profile" link under the player so other users can add each others mp3's to they're own profiles.

either load the "edit page" and transfer the mp3 link to there and have the user just hit submit.

or just add it to the profile without any extra steps.

ideas? :-x

10-31-2006, 04:16 PM
You would need a databse or server side data store of some descirption to match mp3 to user profiles. Presumably there is already a DB for organisation of user profiles. SO why not add an extra table called favourates (or soemthing) and have a relationship between profiles and favourates.

Hope this helps

10-31-2006, 07:07 PM
I think you can do this with or without javascript.

Here is how you can do it without javascript.

have the page post to itself, once a user attempts to add something to their favourite. for example

<a href="<?php echp $_SERVER['PHP_SELF'] . '?track=track_name_here';">trackname</a>

At the top of your page, you should check for any page submission like so

if( isset( $_GET['track'] )
$track = strp_tags( $_GET['track'] );
// add your track to favourite...but make sure that track has not already
// been added

You can also use JavaScript, or Ajax. but them I would strongly suggest that you use something beside ajax or javascript, as the user can easily disable javascript and as such, it won't work.

All the best

11-01-2006, 04:49 AM
im not that smart with php, and i kinda got lost here :( call me stupid or a noob...lol, i'm used to it.

and i know the whole JavaScript issue, but i cant figure out how to do it with php. and i cant find nothing on google for doing it with JavaScript.

Most if not all my users have JavaScript working, at a later time i may fix it for php instead. but for now, i rather just have a simple code to do

UserA visits UserB's profile, there is a mp3 player on UserB's profile, under the mp3 player there is a link that says "Add To Your Profile" UserA clicks it and Vala the same song that was on UserB's profile is now on UserA's.

if there is a "REAL" simple way to do this with php, than yea..
and if this is the simple way, like i said.. i got lost with the whole fav thing

11-01-2006, 04:52 AM
There is no simple way to do this. I think you might be a little in over your head on this one. Writing such script is not something we can just do for you. It will take time. I suggest you hire someone to do this for you.

11-01-2006, 05:21 AM
well that sucks, :(
i know there isn't a simple way.. but idk, but thanks anyways.

I'm 18 and no job openings, so me hiring someone = ain't happening :(

11-01-2006, 11:25 AM
You could prolley adapt some CMS to handle this for you?