Results 1 to 10 of 10

Thread: New to PHP...HELP!!!

  1. #1
    Join Date
    Jan 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default New to PHP...HELP!!!

    I am trying to create a 'recommend this site' form similiar to DHTML Scripts 'Recommend us'. I notice that there is an action up front that sends the application to 'sitesuggest.php'; I am trying to understand why I need that step. Furthermore, if I use the DHTML Scripts 'Recommend Us' it bypasses the 'sitesuggest.php' page and sends me directly to a thankyou.html page.

    Any/all help understanding this will be appreciated...I am not a programmer but I am really trying to understand.

  2. #2
    Join Date
    Jan 2006
    Location
    up here in my tree
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default try this approach next time...

    hi there, "new coder", and Welcome!
    Congratulations on your new membership to one of the best, most comprehensive, knowledgeable, and friendly Web Programming Reseach Communities on the Web! As a newbie, gogogadget, speaking from my experience, i think you'll really like it here and find it to be quite the useful resource for years to come.

    It's unfortunate that I can't answer your question with specifics-- however, i do offer specific advice (all the way at the bottom of my reply), and a general suggestion for you, and a little suggestion on how to maximize your participation, and therefore your benefit from this community.

    (the latter first...). As someone who doesn't really use the DHTML scripts found here very much-- only because i'm weird like that-- [i struggle and struggle to try to do stuff all on my own which probably bites me in the end, and has resulted in some wasted time] i suggest that when you pose your inquiry, in order for someone like myself to provide help, i need to know not references to your problem by way of your description of a "DHTML" script you're working on-- but rather the
    A.) programming language you're working with (i.e. when you say "DHTML Scripts 'Recommend us' ", do you mean you're using CSS / JavaScript, and XHTML [in other words, i can't go and figure it out 'cause of little time]? and then, be specific: is it in particular JavaScipt? Event Handlers? something with the DOM? etc...),
    and
    B.) the Functions within that language; within your example code which may be causing your difficulty. ["..action up front that sends the application to 'sitesuggest.php'"] -- use code examples (i.e. copy / paste your code into the text area here, and wrap it in " [ code ] " tags-- this way, anyone can help-- those of us who are versed in the vast catalogue of scripts here at Dynamic Drive [i.e. the "Recommend Us" script, i think you've mentioned], and those of us who are more into the Community Forum participation.

    if i were able to see your code, i may have been able to help-- but now time has been wasted 'cause you'll either have to wait for someone who knows precisely the script you're referencing (likely a very few members of the community; members whose time is stretched very thin amongst so many others asking similar questions... [i.e. a forum "God" would be nice, but instead, we get real Humans doing the work... hehe ]

    and finally-- so i didn't just post here to listen to myself babble about, on and on...
    i recommend that you step back and think about what's going on with that code. why is it bypassing something which you expect it to do? where is the "train derailing"? believe it or not-- you can figure this out by drawing (page down to Sec. #2 at the URL) using your favourite drawing app, or even Word or Notepad, or on paper -- make a graphical, or "conversational" representation of your script. use arrows, lines, boxes-- figure it out by looking at it that way-- it can really help-- depending on what kind of learner / thinker you are. (i.e. it doesn't work for everyone, but it's an idea.

    hope that helped 'ya with somethin'
    cheers, matey.
    Last edited by a_design_interactive; 01-12-2007 at 12:32 PM.

  3. #3
    Join Date
    Jan 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Here is the exact code I am using as a reference:

    <head>

    <script>

    var ns6=document.getElementById&&!document.all

    function restrictinput(which, maxlength, e){
    if (document.all&&which.value.length>=maxlength){
    return false
    }
    else if (!document.all&&which.value.length>=maxlength){
    var pressedkey=/[a-zA-Z0-9\.\,\/]/ //detect alphanumeric keys
    if (pressedkey.test(String.fromCharCode(e.which)))
    return false
    }
    }

    function checklength(what){
    if (what.message.value.length>200){
    alert ("Please restrict personal message to <200 characters")
    what.message.focus()
    return false
    }
    }

    function alertdefault(){
    alert('This is an email from your friend recommending to you our site http://www.dynamicdrive.com Dynamic Drive is the #1 DHTML site online, featuring 100s of free, original DHTML scripts to enhance your site. Visit us at http://www.dynamicdrive.com')
    }

    </script>

    </head>


    <body>

    <body topMargin=3 marginheight=3>

    <form action="sitesuggest.php" method="post" onsubmit="return checklength(this)">
    <table border="0" width="100&#37;" cellspacing="0" cellpadding="2" bgcolor="#000080" height="28">
    <tr>
    <td width="100%"><b><font size="2" face="Verdana" color="#FFFFFF">&nbsp;Recommend
    DynamicDrive.com to a friend</font></b></td>
    </tr>
    </table>
    <p><font face="Verdana" size="2">Please use the below form to recommend Dynamic
    Drive to your peers and co-workers! You can recommend
    up to 5 friends at once:</font>
    <b><br><font color="#FFFFFF"><small>.</small></font></b></p>

    <div align="center">
    <center>
    <div align="center">
    <table border="0" width="450" cellspacing="0" cellpadding="0">
    <tr>
    <td width="100%">
    <table border="0" width="450" cellspacing="0" cellpadding="3">
    <tr>
    <td width="50%">
    <p align="center"><b>Your name</b></td>
    <td width="50%">
    <p align="center"><b>Your E-mail address</b></td>
    </tr>
    <tr>
    <td width="50%">
    <p align="center"><input type="text" name="userName" size="20"></td>
    <td width="50%">
    <p align="center"><input type="text" name="userEmail" size="25"></td>
    </tr>
    <tr>
    <td width="50%"><font color="#FFFFFF" size="1">.</font></td>
    <td width="50%"></td>
    </tr>
    <tr>
    <td width="50%">

    <p align="center"><b>Friend's name</b></td>
    <td width="50%">
    <p align="center"><b>Friend's E-mail address</b></td>
    </tr>
    <tr>
    <td width="50%">
    <p align="center"><input type="text" name="friendName[]" size="20"></td>
    <td width="50%">
    <p align="center"><input type="text" name="friendEmail[]" size="25"></td>
    </tr>
    <tr>
    <td width="50%">
    <p align="center"><input type="text" name="friendName[]" size="20"></td>
    <td width="50%">
    <p align="center"><input type="text" name="friendEmail[]" size="25"></td>
    </tr>
    <tr>
    <td width="50%">
    <p align="center"><input type="text" name="friendName[]" size="20"></td>
    <td width="50%">
    <p align="center"><input type="text" name="friendEmail[]" size="25"></td>
    </tr>
    <tr>
    <td width="50%">
    <p align="center"><input type="text" name="friendName[]" size="20"></td>
    <td width="50%">
    <p align="center"><input type="text" name="friendEmail[]" size="25"></td>
    </tr>
    <tr>
    <td width="50%">
    <p align="center"><input type="text" name="friendName[]" size="20"></td>
    <td width="50%">
    <p align="center"><input type="text" name="friendEmail[]" size="25"></td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td width="100%" align="center">
    <p align="center"><br>
    <b><a href="#" onClick="alertdefault();return false">View Default message added</a></b><br>
    <br>
    <b>Add your personal message (optional):</b><br>
    <textarea rows="4" name="message" cols="32" wrap="virtual" onkeypress="return restrictinput(this, 200, event)"></textarea></p>
    <p align="center"><input type="submit" value="Recommend Dynamic Drive" name="B1">
    </td>
    </tr>
    </table>
    </div>
    </center>
    </div>
    </form>

    <p align="center"><font size="1" face="Arial">CopyRight &#169; 1998-2002 <a href="http://www.dynamicdrive.com">Dynamic
    Drive</a>.</font>

    </p>

    </body>


    I am just try to understand the sitesuggest.php part and what I need to do to make this code perform the task of recommending this site to friends.

    Thanks again!!!

  4. #4
    Join Date
    Jan 2006
    Location
    up here in my tree
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    going from what you said about you're "not a programmer"...

    the most important part of what you posted is in this bit of code (i think), is this:
    Code:
    <form action="sitesuggest.php" method="post" onsubmit="return checklength(this)">
    do you know what this part does? what is the name of the file which contains this code (the part i pasted above)? is it also named "sitesuggest.php", or is that a separate file? if it is a separate file-- that is probably where you need to look for debugging as that is where the "action" takes place-- all this part seems to do (from my sophomoric understanding of things) is check the validity of the user input and then send the data collected to another file, named sitesuggest.php

    why doesn't it work? what are your symptoms? where does it hurt?

  5. #5
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    The problem that gogogadget has is that he/she doesn't know PHP, and wants to get the code for sitesuggest.php. This thread is a double post of the one in the JS forum. Also, the code that was pasted by him/her was taken from the Dynamic Drive website.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  6. #6
    Join Date
    Jan 2006
    Location
    up here in my tree
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ah-- so, in otherwords, this person doesn't understand that what he or she is trying to do is perhaps unethical, and-- due to the fact that the code they seek is something which is unavailable for proprietary reasons, simply not up for discussion... something like that? i wasn't really paying attention to the particulars--

    i'm glad someone more familiar w/ the D.D. scripts was able to catch all that.


    just tryin' to pass the help around-- but maybe it's better i keep my mouth shut since i don't really know the particulars of the community so well.

    ah... what can ya do. i guess it was kind of a weird post then

  7. #7
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    Haha, not really that it wasn't up for discussion, just that it wasn't in the right area of the forums to be answered. Since it's a DD script, it should've been posted in the DD Scripts area.

    However, it is questionable since the actual question was based upon the PHP aspect of this code and thus, I guess posting it in the PHP section is acceptable.

    But...it was double posted...and that's not acceptable.
    Thou com'st in such a questionable shape
    Hamlet, Act 1, Scene 4

  8. #8
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    That and also the fact that the HTML code posted by the OP is taken directly from this Dynamic Drive page.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  9. #9
    Join Date
    Jan 2006
    Location
    up here in my tree
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by thetestingsite View Post
    the HTML code posted by the OP is taken directly from this Dynamic Drive page.
    ... right. that's the tip that i got from tts's input.
    is ignorance bliss? does a bear hear a tree fall in the woods when he's... err... hmm... one will never know.

  10. #10
    Join Date
    Jan 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow

    Do you just want a "Tell-A-Friend" application? Or do you want that exact app? I can refer you to a CGI-based tell-a-friend, and I can refer you to a PHP-based tell-a-friend.

    Yeah... if I got this right, some info might be useful: you can't get somebody's PHP code by yourself without hacking. It's all server-side. There are some sites that will give you the PHP and tell you what to do, though... ?

Bookmarks

Posting Permissions

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