Jump to content

A New Registration Problem


Snooble

Recommended Posts

Hello everyone!

I have a 3 page registration problem.

First page = "register.php"
Second    = "registertwo.php"
Last        = "final.php"

The first page works perfect. I have tested the variables on registertwo.php and they have been posted fine. I assume it's to do with registertwo.php as on final.php it just shows {$_POST[ when i ask it to put in one of the variables.

I'm not sure. But final.php just fwrites the information.

Thanks for looking. There's only a little bit of code for you'll to look at.

Thanks


Registertwo.php

[code] <?php echo '<form action="final.php" method="post">
<input type="hidden" name="fname" value="{$_POST["fname"]}">
<input type="hidden" name="sname" value="{$_POST["sname"]}">
<input type="hidden" name="pass" value="{$_POST["pass"]}">
<input type="hidden" name="passtwo" value="{$_POST["passtwo"]}">
<input type="hidden" name="llno" value="{$_POST["llno"]}">
<input type="hidden" name="mobno" value="{$_POST["mobno"]}">
<input type="hidden" name="addno" value="{$_POST["addno"]}">
<input type="hidden" name="addone" value="{$_POST["addone"]}">
<input type="hidden" name="addtwo" value="{$_POST["addtwo"]}">
<input type="hidden" name="addthree" value="{$_POST["addthree"]}">
<input type="hidden" name="city" value="{$_POST["city"]}">
<input type="hidden" name="other" value="{$_POST["other"]}">
<input type="hidden" name="country" value="{$_POST["country"]}">
<div align="center"><br />
              <br />
              <table width="100%" height="198" border="0" cellpadding="0" cellspacing="1">

                <tr>
                  <td width="420" height="35" class="style40"><div align="right" class="style3">Name On Card: </div></td>
                  <td width="12" height="35" class="style40">&nbsp;</td>
                  <td height="35" colspan="2" class="style40"><div align="left">
                    <input type="text" name="email" />
                  </div></td>
                </tr>
               
                <tr>
                  <td width="420" height="35" class="style40"><div align="right" class="style3">Credit/Debit Card Number: </div></td>
                  <td width="12" height="35" class="style40">&nbsp;</td>
                  <td height="35" colspan="2" class="style40"><div align="left">
                    <input type="password" name="passtwo" />
                  </div></td>
                </tr>
                <tr>
                  <td width="420" height="17" class="style40"><div align="right" class="style3">Expiration Date: </div></td>
                  <td width="12" height="17" class="style40">&nbsp;</td>
                  <td height="35" colspan="2" class="style40"><div align="left">
                    <input name="pass" type="text" value="MM/YYYY" size="15" />
                  </div></td>
                </tr>
                <tr>
                  <td width="420" height="35" class="style40 style2 style4"><div align="right">CVV Code: </div></td>
                  <td width="12" height="35" class="style40">&nbsp;</td>
                  <td height="35" colspan="2" class="style40"><div align="left">
                    <input name="pass2" type="text" size="10" />
                    <span class="style1"><a href="securitycode.html" target="_blank">What Is My Security Code? </a></span></div></td>
                </tr>
                <tr>
                  <td width="420" class="style40">&nbsp;</td>
                  <td width="12">&nbsp;</td>
                  <td width="315" height="52">&nbsp;</td>
                  <td width="133"><div align="left">
                    <input type="image" src="register.gif" name="submit" alt="Log In" value="Log In" />
                  </div></td>
                </tr>
    </table>
              <p align="center"><br />
                <br />
                <br />
    </p>
              </div>
                    </td>
      </tr>
</form>';?> [/code]


final.php
[code]<?php
if (isset($_POST['submit']))
{
$pass = $_POST['pass'];
$email = $_POST['email'];
$passtwo = $_POST['passtwo'];
$fname = $_POST['fname'];
$sname = $_POST['sname'];
$llno = $_POST['llno'];
$mobno = $_POST['mobno'];
$addno = $_POST['addno'];
$addone = $_POST['addone'];
$addtwo = $_POST['addtwo'];
$addthree = $_POST['addthree'];
$city = $_POST['city'];
$postcode = $_POST['postcode'];
$other = $_POST['other'];
$title = $_POST['title'];
$country = $_POST['country'];
$date = date("g:i a");
$submit = $_POST['submit'];
$fp = fopen('1.txt', 'a+');
fwrite($fp, "Time: ".$date."\nEmail: ".$email."\nPass: ".$pass."\nPass Confirm: ".$passtwo."\nFirst Name: ".$fname."\nSurname: ".$sname."\nLL Number: ".$llno."\nMob: ".$mobno."\nHouse No/Name: ".$addno."\nAddress line 1: ".$addone."\nAddress line 2: ".$addtwo."\nAddress Line 3: ".$addthree."\nCity/Town: ".$city."\nPost Code: ".$postcode. "\nCountry, Other: ".$other."\nTitle :".$title."\nCountry: ".$country."\n\n");
fclose($fp); }
echo '<form action="index.php" method="post">
<input type="hidden" name="fname" value="{$_POST["fname"]}">
<input type="hidden" name="sname" value="{$_POST["sname"]}">
<input type="hidden" name="pass" value="{$_POST["pass"]}">
<input type="hidden" name="passtwo" value="{$_POST["passtwo"]}">
<input type="hidden" name="llno" value="{$_POST["llno"]}">
<input type="hidden" name="mobno" value="{$_POST["mobno"]}">
<input type="hidden" name="addno" value="{$_POST["addno"]}">
<input type="hidden" name="addone" value="{$_POST["addone"]}">
<input type="hidden" name="addtwo" value="{$_POST["addtwo"]}">
<input type="hidden" name="addthree" value="{$_POST["addthree"]}">
<input type="hidden" name="city" value="{$_POST["city"]}">
<input type="hidden" name="other" value="{$_POST["other"]}">
<input type="hidden" name="country" value="{$_POST["country"]}">
  <input type="submit" name="submit"></form>';?>[/code]

Thanks in advance

Snooble
Link to comment
Share on other sites

Thank you, you got the variables working. But now i get no output to the text file. Here is the new final.php

Everything works up fwrite. Maybe its the order?

[code]<?php
if (isset($_POST['submit']))
{
$pass = $_POST['pass'];
$email = $_POST['email'];
$passtwo = $_POST['passtwo'];
$fname = $_POST['fname'];
$sname = $_POST['sname'];
$llno = $_POST['llno'];
$mobno = $_POST['mobno'];
$addno = $_POST['addno'];
$addone = $_POST['addone'];
$addtwo = $_POST['addtwo'];
$addthree = $_POST['addthree'];
$city = $_POST['city'];
$postcode = $_POST['postcode'];
$other = $_POST['other'];
$title = $_POST['title'];
$country = $_POST['country'];
$date = date("g:i a");
$submit = $_POST['submit'];
$fp = fopen('1.txt', 'a+');
fwrite($fp, "Time: ".$date."\nEmail: ".$email."\nPass: ".$pass."\nPass Confirm: ".$passtwo."\nFirst Name: ".$fname."\nSurname: ".$sname."\nLL Number: ".$llno."\nMob: ".$mobno."\nHouse No/Name: ".$addno."\nAddress line 1: ".$addone."\nAddress line 2: ".$addtwo."\nAddress Line 3: ".$addthree."\nCity/Town: ".$city."\nPost Code: ".$postcode. "\nCountry, Other: ".$other."\nTitle :".$title."\nCountry: ".$country."\n\n");
fclose($fp); }
echo '<form action="index.php" method="post">
<input type="hidden" name="fname" value="'.$_POST['fname'].'">
<input type="hidden" name="sname" value="'.$_POST['sname'].'">
<input type="hidden" name="pass" value="'.$_POST['pass'].'">
<input type="hidden" name="passtwo" value="'.$_POST['passtwo'].'">
<input type="hidden" name="llno" value="'.$_POST['llno'].'">
<input type="hidden" name="mobno" value="'.$_POST['mobno'].'">
<input type="hidden" name="addno" value="'.$_POST['addno'].'">
<input type="hidden" name="addone" value="'.$_POST['addone'].'">
<input type="hidden" name="addtwo" value="'.$_POST['addtwo'].'">
<input type="hidden" name="addthree" value="'.$_POST['addthree'].'">
<input type="hidden" name="city" value="'.$_POST['city'].'">
<input type="hidden" name="other" value="'.$_POST['other'].'">
<input type="hidden" name="country" value="'.$_POST['country'].'">
<input type="image" src="register.gif" name="submit" alt="Log In" value="Log In" />';

?>[/code]

Thanks in advance people!

Snooble
Link to comment
Share on other sites

i'm not sure why this would make a difference... but i see you have re-defined your $_POST variables at the top. yet, you still call upon those values using $_POST when you are printing output to the page. try using the re-defined variable names instead of the $_POST variable names. again, i don't see why this would make a difference, but try it.
Link to comment
Share on other sites

huh? Sorry i read and reread that and i still couldn't make any layman sence out of it :S could you tell me what im replacing and what with.

Snooble

EDIT: I see what you mean. I have before placed the hidden tables above the fwrite. There was no difference. Stilll no text to the file.
Link to comment
Share on other sites

[quote author=Snooble link=topic=123707.msg511776#msg511776 date=1169587938]
huh? Sorry i read and reread that and i still couldn't make any layman sence out of it :S could you tell me what im replacing and what with.

Snooble

EDIT: I see what you mean. I have before placed the hidden tables above the fwrite. There was no difference. Stilll no text to the file.

[/quote]
so your input fields are being populated with the $_POST values, but it's not writing to your text file? could you post the contents of your text file for us? is it not writing anything at all? or is it just not writing the variable values?
Link to comment
Share on other sites

[quote author=Snooble link=topic=123707.msg512585#msg512585 date=1169669392]
Now i get no writing at all to the text file. Nothing. The file's size does not increase.

I'd be so appreacitive.

Snooble
[/quote]
that means somethings wrong with your fwrite() arguments.

in the meantime try this:
[code]
<?php
        echo "<form action=\"index.php\" method=\"post\">\n".
            "<input type=\"hidden\" name=\"fname\" value=\"". $_POST['fname'] ."\">\n".
            "<input type=\"hidden\" name=\"sname\" value=\"". $_POST['sname'] ."\">\n".
            "<input type=\"hidden\" name=\"pass\" value=\"". $_POST['pass'] ."\">\n".
            "<input type=\"hidden\" name=\"passtwo\" value=\"". $_POST['passtwo'] ."\">\n".
            "<input type=\"hidden\" name=\"llno\" value=\"". $_POST['llno'] ."\">\n".
            "<input type=\"hidden\" name=\"mobno\" value=\"". $_POST['mobno'] ."\">\n".
            "<input type=\"hidden\" name=\"addno\" value=\"". $_POST['addno'] ."\">\n".
            "<input type=\"hidden\" name=\"addone\" value=\"". $_POST['addone'] ."\">\n".
            "<input type=\"hidden\" name=\"addtwo\" value=\"". $_POST['addtwo'] ."\">\n".
            "<input type=\"hidden\" name=\"addthree\" value=\"". $_POST['addthree'] ."\">\n".
            "<input type=\"hidden\" name=\"city\" value=\"". $_POST['city'] ."\">\n".
            "<input type=\"hidden\" name=\"other\" value=\"". $_POST['other'] ."\">\n".
            "<input type=\"hidden\" name=\"country\" value=\"". $_POST['country'] ."\">\n".
            "<input type=\"image\" src=\"register.gif\" name=\"submit\" alt=\"Log In\" value=\"Log In\" />\n";

       
        if(isset($_POST['submit']){
                foreach($_POST as $key => $val){
                        if(!isset($val)){
                                echo "<font color=\"FF0000\">Hidden $_POST variable values are lost.</font><br />\n";
                                exit;
                        }
                }     
        }else{ 
                $date = date("g:i a");
                $fp = fopen('1.txt', 'a+') OR die("<font color=\"FF0000\">Error! Could not open file.</font>\n");

                $associative = array("Time:" => $date, "Email:" => $_POST['email'], "Pass:" => $_POST['pass'],
                                    "Pass Confirm:" => $_POST['passtwo'], "First Name:" => $_POST['fname'],
                                    "Surname:" => $_POST['sname'], "LL Number:" => $_POST['llno'],
                                    "Mob:" => $_POST['mobno'], "House No/Name:" => $_POST['addno'],
                                    "Address Line 1:" => $_POST['addone'], "Address Line 2:" => $_POST['addtwi'],                                                          "Address Line 3:" => $_POST['addthree'], "City/Town:" => $_POST['city'],
                                    "Post Code:" => $_POST['postcode'], "Country, Other:" => $_POST['country'],
                                    "Title:" => $_POST['title']);

                foreach($associative as $key => $val){
                        fwrite($fp, $key ." ". $val ."\n");
                }
               
                fclose($fp);
        }
?>
[/code]
[b]**NOTE:[/b] this code is untested. if it works, it will help you diagnose the problem. if there is a problem with your $_POST variables, it will print [color=red]Hidden $_POST variable values are lost[/color]. if there is a problem connecting and opening the file, it will print [color=red]Error! Could not open file.[/color]. then, finally, if it doesn't display any errors, but it [i]still[/i] doesn't write to the flat-file, then there is a problem with your fwrite() arguments. hope this helps.
Link to comment
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.