Jump to content

Archived

This topic is now archived and is closed to further replies.

patk24

Why's this happeneing?

Recommended Posts

ok i use this code for my website:

[code]
<form method='post'>
<div class="row">
    Name<input name='Name' type='text' /><br />
<div class="row">
    Email<input name='Email' type='text' /><br />
<div class="row">
    Comment<input name='Comment' type='text' /><br />
<div class="row" >
    <input type='submit' value='      Confirm Account'  name='Confirm' />
</form>
<?php


if(sizeof($_POST)>0)
{
    $filename = "subscribers.txt";
    $content = $_POST['Name']."\n".$_POST['Email']."\n".$_POST['Comment']."\n\n\n";
    $fp = fopen($filename, "a");
    $fw = fwrite( $fp, $content );
    fclose( $fp );
   
    if(!$fw) echo "Couldn't write the entry.";
    else echo "Successfully wrote to the file.";
}
?>

[/code]

when i load it through my php server (easyphp1.8) it works fine but when i load it to my site on freehostia.com it doenst work..
i get the text boxes but underneath that is the php script all the letters and symbolys..

wats wrong with wat im doing?

Share this post


Link to post
Share on other sites
Are you saving the code as a .php file?  Does freehostia.com offer php? 

Share this post


Link to post
Share on other sites
hey it does support php and i am saving it as a .php maybe i can try another host
we'll see what happeneds

Share this post


Link to post
Share on other sites
Create a page that looks like this:

[size=8pt][b]info.php[/b][/size]
[code]
<?php
  phpinfo();
?>
[/code]

Upload it to your server in ascii and make sure it has the correct permissions.  Then open it in the browser and see what happens.

If you get info about the php installation then it's worked ok, if not you need to contact your host and see if there's something they need to enable, or find out if they can offer you any support.

Regards
Huggie

Share this post


Link to post
Share on other sites
try this ok
[code]
<form method='POST' action="">
<div class="row">
    Name<input name='Name' type='text' /><br />
<div class="row">
    Email<input name='Email' type='text' /><br />
<div class="row">
    Comment<input name='Comment' type='text' /><br />
<div class="row" >
    <input type='submit' value='       Confirm Account'  name='Confirm' />
</form>
<?php


if($_POST['confirm']){

    $filename = "subscribers.txt";
    $content = $_POST['Name']."\n".$_POST['Email']."\n".$_POST['Comment']."\n\n\n";
    $fp = fopen($filename, "a+");
    $fw = fwrite( $fp, $content );
    fclose( $fp );
   
    if(!$fw) echo "Couldn't write the entry.";
    else echo "Successfully wrote to the file.";
}
?>
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.