Log in

View Full Version : New to PHP...HELP!!!



gogogadget
01-11-2007, 08:43 PM
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.

a_design_interactive
01-12-2007, 12:23 PM
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 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 [i]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 (http://www.vogue.is.uec.ac.jp/~koike/papers/vl95/vl95.html) (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.

gogogadget
01-13-2007, 12:19 AM
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!!!

a_design_interactive
01-13-2007, 03:17 PM
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:
<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?

thetestingsite
01-13-2007, 03:24 PM
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.

a_design_interactive
01-13-2007, 03:41 PM
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

alexjewell
01-13-2007, 05:00 PM
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.

thetestingsite
01-13-2007, 05:06 PM
That and also the fact that the HTML code posted by the OP is taken directly from this Dynamic Drive page (http://www.dynamicdrive.com/recommendit/).

a_design_interactive
01-21-2007, 10:22 PM
the HTML code posted by the OP is taken directly from this Dynamic Drive page (http://www.dynamicdrive.com/recommendit/).
... 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. ;)

cowguru2000
01-23-2007, 12:07 AM
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... ?