Im doing an project and im not the best at php at all so really need your help, I'm trying to send user data to another location and store it to a text file, so i pass the information over and catching it with this code
<?php
$colorpreference = $_GET['userinformation'];
$ip = getenv ('REMOTE_ADDR');
$date=date("j F, Y, g:i a");;
$referer=getenv ('HTTP_REFERER');
$fp = fopen('colorpreference.txt', 'a');
fwrite($fp, 'Data: '.$colorpreference.'<br> IP: ' .$ip. '<br> Date and Time:
' .$date. '<br> Referer: '.$referer.'<br><br><br>');
fclose($fp);
header ("Location: /thankyou.html");
?>
This is the data being passed is
http://www.myserver.com/test2.php?us...olour=#FFFFFF;
but once the script gets to saving the # symbol it stops and all i get
in the text file is
Data: Email=myemail@gmail.com; Username=correctusername;
Colour=<br> IP: correct ip here<br> Date and Time: 4 May,
2006, 4:30 pm<br> Referer: <br><br><br>
Is there anyway i could just tell the script to convert everything to
a string and save it or maybe since i know whats being passed could i
just set it up to expect the colour field to be characters, or take out the # character before i store the answer and put it in later when i need it?
But actually when i check the file before it gets sent over sometimes it has two hash symbols like ##FFFFFF I cant help this but maybe it will help the solution.
any ideas?
other code ive tried with it is
<?php
$colorpreference = $HTTP_GET_VARS["userinfo"];
$ip = getenv ('REMOTE_ADDR');
$file = fopen('colorpreference .txt', 'a');
fwrite($file, $colorpreference . "\n\n");
header ("Location: /index.php"); //<-------After it redirects to another page.
?>
<?php
$f = fopen(“colorpreference .txt”, “a”);
fwrite($f, “IP: {$_SERVER[‘REMOTE_ADDR’]} Ref: {$_SERVER
[‘HTTP_REFERER’]} Data: {$HTTP_GET_VARS[‘userinfo’]}\n”);
fclose($f);
?>
But yet again the same problem it doesnt store anything after the #