Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Oct 2006
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need help with some kind of javascript form

    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

  • #2
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts
    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

  • #3
    ess
    ess is offline
    Regular Coder
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    866
    Thanks
    7
    Thanked 30 Times in 29 Posts
    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

    PHP Code:
    <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
    PHP Code:
    <?php
    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

  • #4
    New Coder
    Join Date
    Oct 2006
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    yea

    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

  • #5
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #6
    New Coder
    Join Date
    Oct 2006
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    well

    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

  • #7
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts
    You could prolley adapt some CMS to handle this for you?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •