我想从http://mywebsite1.com/register.php?log=firstname=Yoga&lastname=Galih
收集信息,但我想这些信息对我的使用PHP $ _GET第二的网站,并把它保存到reg.log
<?php
$txt = "reg.log";
if (isset($_GET["log"]) && isset($_GET["firstname"]) && isset($_GET["lastname"]) && isset($_GET["address"]) && isset($_GET["city"]) && isset($_GET["state"]) && isset($_GET["zip"]) && isset($_GET["country"]) && isset($_GET["phone"]) $$ isset($_GET["gender"]) && isset($_GET["haircolor"]) && isset($_GET["eyecolor"]) && isset($_GET["high"]) isset($_GET["weight"])) {
$firstname = $_GET["fname"];
$lastname = $_GET["lname"];
$address = $_GET["address"];
$city = $_GET["city"];
$state = $_GET["state"];
$zip = $_GET["zip"];
$country = $_GET["country"];
$gender = $_GET["gender"];
$haircolor = $_GET["hcolor"];
$eyecolor = $_GET["ecolor"];
$high = $_GET["high"];
$weight = $_GET["weight"];
$phone = $_GET["phone"];
echo $firstname .PHP_EOL. $lastname .PHP_EOL. $address .PHP_EOL. $city .PHP_EOL. $state .PHP_EOL. $zip .PHP_EOL. $country .PHP_EOL. $phone .PHP_EOL. $hcolor .PHP_EOL. $ecolor .PHP_EOL. $high .PHP_EOL. weigh .PHP_EOL. gender;
$fh = fopen($txt, 'a');
fwrite($fh,$txt); // Write information to the file
fclose($fh); // Close the fil
}
?>
,但我得到的错误[ 3月21日-2016 15时17分09秒美国/纽约] PHP解析错误:语法错误,意想不到的 '$' 在/home/my2ndweb/public_html/includes/register.php上线3
我需要帮助
谢谢
在isset之前忘了&&($ _ GET [“weight”] – frosty
将它们全部放在一个'isset'中。 http://php.net/manual/en/function.isset.php'如果提供了多个参数,则只有在设置了所有参数的情况下,isset()才会返回TRUE。评估从左到右,遇到未设置的变量时立即停止。“# – chris85
**语法错误:**使用适当的IDE,如Netbeans或PHPStorm – CodeGodie