Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie: PHP/Tell-A-Friend HELP 1

Status
Not open for further replies.

cann46

Technical User
Oct 18, 2003
8
US
Can anyone help me with php code and making it work on yahoo server. I am trying to learn php and make it work on my site. I am getting all kind of errors and stuff.

Thanks . . .
 
cann46,

You say "on Yahoo server" -a free web-space provided by Yahoo?

I've never seen any free webhostings that support server side scripts like PHP. However, if you want to try it out, here's how to do it:

Copy this script and paste it into a text editor like note pad:

[tt]<? echo &quot;Hi there!&quot;; ?>[/tt]

Save it as test.php and upload it to the server. Then type the location :
If you see Hi there! in your browser window, then PHP is supported and you can move on. If you see anything else, then you should consider buying a domain name and a webhost provider!

In Denmark you can do all that for 50 € including everything plus first year of webhosting (100MB, PHP etc.).

Tell a friend script? Try this:

Collect form:

[tt]<HTML>
<HEAD>
<TITLE></TITLE>
<LINK REV=&quot;made&quot; HREF=&quot;mailto:&quot;>
<META NAME=&quot;generator&quot; CONTENT=&quot;NoteTab Light 4.95&quot;>
<META NAME=&quot;author&quot; CONTENT=&quot;&quot;>
<META NAME=&quot;description&quot; CONTENT=&quot;&quot;>
<META NAME=&quot;keywords&quot; CONTENT=&quot;&quot;>
</HEAD>

<BODY BGCOLOR=&quot;#FFFFFF&quot; TEXT=&quot;#000000&quot; LINK=&quot;#0000FF&quot; VLINK=&quot;#800080&quot; ALINK=&quot;#FF0000&quot;>
<H1>TELL A FRIEND!</H1>
<FORM ACTION=&quot;mailfriend.php&quot; METHOD=&quot;POST&quot;>
Your name : <INPUT NAME=&quot;YourName&quot; TYPE=&quot;text&quot;><BR>
Friends e-mail : <INPUT NAME=&quot;FriendsEmail&quot; TYPE=&quot;text&quot;><BR>
<INPUT TYPE=&quot;submit&quot; VALUE=&quot;Tell a friend!&quot;>
</FORM>
</BODY>
</HTML>[/tt]

... and the script to send the mail (named mailfriend.php):

[tt]<?
$name = $_REQUEST[&quot;YourName&quot;];
$to_address = $_REQUEST[&quot;FriendsEmail&quot;];

$yourSite = &quot;
$message = $name.&quot; wants you to have a look at this site:\r\n&quot;;

$message .= $yourSite;

$subject = &quot;Cool site!&quot;;

mail($to_address, $subject, $message);
?>[/tt]

Good luck §;O)


Jakob
 
There are several free webhosting providers in Czech Republic who supports PHP and MySQL (50 MB web space+2 MB MySQL database) but I noticed that these web pages cannot be accessed from US. I also don't expect that you can speak czech so this will be useless for you. Here is the link though:
 
It's not free. They are web hosting for the site. They do support php and MySQL. I will try your code and see if it works for me. Thank you for your help. Let's see how it goes.
 
Well, it worked except when I hit the send button, I get nothing. I saved the first part as tell.php. Then I added site information in the mailfriend.php file. Nothing happened when I hit submit.

Getting close.

More help please.
 
cann46,

The first part (the form) is just an html file. Call it what you like (even .php).

The second part should be saved as a .php file <= named after the ACTION in the FORM tag on the first file.

You're right -nothing is displayed on the screen when you hit submit. However, a mail should be sent. Check with your hosting provider to see if they support the mail() function -some don't because of the potiential spam use of the function...

Good luck §;O)


Jakob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top