t_constant_encasped_string....??

Hi, I’m new here! I thought of this code myself, even though I’m just learning php. I guess I’ll tell you whatim trying to do. I have a person type some info on the websites index.php page, then when they press enter, it brings them to input_info.php (this page). It gathers there data, and creates a WebPage out of it. What I want it to do is that when is saves the file in the root directory, I want to move it to the pages directory. But when it try’s to move the file, it brings up this error:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/a7430326/public_html/input_info.php on line 13
Here is my code:

[php]

yay, it worked…

<?php $sig = $_GET["yoursig"]; $contents = $_GET["content"]; $yourName = $_GET["yourname"]; $ourFileName = $_GET["fname"]; $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); echo fwrite($ourFileHandle, "
The person who made this is called $yourName, and this person created *$ourFileName*!
"); echo fwrite($ourFileHandle, "$contents"); echo fwrite($ourFileHandle, "$sig"); fclose($ourFileHandle); copy("/"+$ourFileName, "/pages/"+$ourFileName); ?>[/php]

Can you help me?

Well, in PHP you combine strings with “.” NOT “+”… The plus means ADD not CONCAT…

So your line is trying to do some math on the two strings.

Change: copy("/"+$ourFileName, “/pages/”+$ourFileName);

To: copy("/" . $ourFileName, “/pages/” . $ourFileName);

Hope that helps… Good luck…

Thank you, it worked… but now it says

Parse error: syntax error, unexpected T_VARIABLE in /home/a7430326/public_html/input_info.php on line 4

And I’m using my code, and the code you gave me…

Well, if that was your same code, line 4 is: $sig = $_GET[“yoursig”];
That line says you are passing a variable as as an argument.
That would be done something like: www.yourdomain.com/index.php?yoursig=3
or something similar. So, if your are really passing this from a posted form, you should be using
$sig=$_POST[‘yoursig’]; instead. That will pull a field value from a posted form.

Not sure which is correct as I can not see all your code. Hope that helps. (I’m going to bed, so tomorrow!)

Sponsor our Newsletter | Privacy Policy | Terms of Service