/    Sign up×
Community /Pin to ProfileBookmark

Where to test scripts

Hello all,

I am new here.
I am just beginning to learn PHP, which is very interesting, and I have made a few tiny scripts. I’d like to test these out to see if they work and here is my problem. The webspace I have from my ISP-server doesn’t support PHP.

So, where would I go to test these scripts?

Do you guys know any free webhost that supports PHP?
Or what may be also possible, I’ve been reading in a couple topics this:
“do you have PHP installed?”

Installing PHP?? I’d love to hear some more about that.
How do I get PHP installed on my pc?

Well, any help will be appriciated

wietsed

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@NogDogAug 13.2006 — You can install [url=http://www.apachefriends.org/en/xampp.html]XAMPP[/url] on your PC, which will install Apache web server, PHP, Perl, and MySQL; allowing you to test scripts locally on your PC (Linux, Windows, Mac are all supported).
Copy linkTweet thisAlerts:
@wietsedauthorAug 13.2006 — Hey, thanks a lot!!!

I've been playing around with it all evening, even got some mail functions working (mailing to @localhost adress).

Very nice program, now I can continue with my PHP scripts.

Right now I am working on a form that needs to be mailed in HTML.

Haven't figured it out yet.

Here is the HTML form:

[code=html]
<form name="form" method="post" action="mailform.php">
<table border="0" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111" width="700">
<tr class="text_main10">
<td width=75%>Name:</td>
<td width=25% aligh=left>Date:</td>
</tr>
<tr>
<td width="75%" height="12">
<input type="text" name="NAME" size="75"></td>
<td><input type="text" name="DATE" size="20"></td>
</tr>
</table>

<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="700">
<tr>
<td height="5" width="346"></td>
<td height="5" width="174"></td>
<td height="5" width="176"></td>
</tr>
<tr class="text_main10">
<td width="75%">Current address:</td>
<td width="25%">Phone:</td>
</tr>
<tr>
<td width="75%"><input type="text" name="ADRESS" size="75"></td>
<td width="25%"><input type="text" name="PHONE" size="20"></td>

</tr>
</table>

<table border="0" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111" width="700">
<tr class="text_main10">
<td width=40%>Birthplace:</td>
<td width=35%>Birthdate:</td>
<td width=25%>Sex:</td>
</tr>
<tr>
<td width="40%" height="12">
<input type="text" name="BIRTHPLACE" size="40"></td>
<td width=35%><input type="text" name="BIRTHDATE" size="20"></td>
<td width=25%>
<select name="SEX" />
<option>select
<option>Male
<option>Female
</select>
</td>
</tr>
</table>
</form>
[/code]


And here is the PHP script (mailform.php):
[code=php]
<?php

$to = 'myself@localhost';
$subject = 'Test form';
$headers = 'MIME-Version: 1.0' . "rn";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";



if (($NAME == "") || ($DATE == "") || ($ADRESS == "") || ($PHONE == ""))
{
echo "<form name=form method=post action=mailform.php>";
echo "<p class=bodymd>The following fields are required, you haven't filled them out.</p>";
echo "<p class=bodymd>Fill in the ones you missed, they are listed below.</p>";
}

if ($NAME == "") { echo "<p class=bodymd>Your Name<br><input type=text name=NAME></p>";}
else {echo "<input type=hidden name=Name value=$NAME>";}

if ($DATE == ""){ echo "<p class=bodymd>Today's Date<br><input type=text name=DATE></p>";}
else {echo "<input type=hidden name=DATE value=$DATE>";}

if ($ADRESS == ""){ echo "<p class=bodymd>Street Adress<br><input type=text name=ADRESS></p>";}
else {echo "<input type=hidden name=ADRESS value=$ADRESS>";}

if ($PHONE == ""){ echo "<p class=bodymd>Phone<br><input type=text name=PHONE></p>";}
else {echo "<input type=hidden name=PHONE value=$PHONE>";}



if (($NAME == "") || ($DATE == "") || ($ADRESS == "") || ($PHONE == ""))
{
echo "<input type=submit name=Submit value=Submit>";
echo "<input type=reset name=Reset value=Clear Form>";
echo "</form>";
}
else
{
$message =
"Name: $NAMEn
Date: $DATEn
Adress: $ADRESSn
Phone: $PHONEn
Birthplace: $BIRTHPLACEn
Birthdate: $BIRTHDATEn
Sex: $SEXn
";


$extra =
"From: $NAMErn
";


mail ($to, $subject, $message, $extra);
echo "<p class=bodymd>Thanks for your application, $Name.</p>";
echo "<p class=bodymd>A response will be sent to $Email as soon as possible.</p>";
}
?>
[/code]


Now instead of :

[code=php] $message =
"Name: $NAMEn
Date: $DATEn
Adress: $ADRESSn
Phone: $PHONEn
Birthplace: $BIRTHPLACEn
Birthdate: $BIRTHDATEn
Sex: $SEXn
";
[/code]


I wanted something like this:
[code=php] $message =
"<html>
<head><body>
<table border=0>
<tr>
<td>Name</td> <td>$name</td>
</tr>
<tr>
<td>Date</td> <td>$date</td>

etc etc

";
[/code]



But so far it just won't seem to work.

(ps, sorry for the long post)
Copy linkTweet thisAlerts:
@The_Little_GuyAug 13.2006 — This will allow you to add HTML to your mail
[code=php]
$headers = 'MIME-Version: 1.0' . "rn";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";
$headers .= "From: WHO ITS FROM rn" . "X-Mailer: PHP/" . phpversion();
[/code]
Copy linkTweet thisAlerts:
@wietsedauthorAug 14.2006 — Thank you very much!

That dioes the trick.

But why do I need to put an e-mail adress in the "From:" field, and not just a plain name?

It only works with:

"From: $email" and not with "From: $name"

any suggestions? I can't seem to figure out why
Copy linkTweet thisAlerts:
@FireCracker37Aug 14.2006 — do it like this: 'From: $name <$email>" and it should show up in your inbox with the person's name, and if you click reply it will go to their e-mail addy.

Also when I got started in PHP I used awardspace.com as my testing server (along with my PC), but it helped to have someplace viewable online so that if I needed help with something, I could link to the page in a forum.
×

Success!

Help @wietsed spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...