Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.