Jump to content

Why's this happeneing?


patk24

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?
Link to comment
https://forums.phpfreaks.com/topic/21823-whys-this-happeneing/
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
Link to comment
https://forums.phpfreaks.com/topic/21823-whys-this-happeneing/#findComment-98607
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]
Link to comment
https://forums.phpfreaks.com/topic/21823-whys-this-happeneing/#findComment-98643
Share on other sites

Archived

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

×
×
  • Create New...

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.