Jump to content


Photo

Carrying variables.


  • Please log in to reply
15 replies to this topic

#1 Dobakat

Dobakat
  • Members
  • PipPipPip
  • Advanced Member
  • 54 posts

Posted 24 April 2006 - 11:12 PM

Well I thought that this form
<form action="register3.php?var1=$random&var2=$user" method="POST">
<table align="center" border="0" cellspacing="0" cellpadding="3">
<tr><td width="240" align="right">
  <div align="center">
  <input type="hidden" name="subjoin" value="1">
  <input type="submit" value="Next">
  </div></td></tr>
<tr><td align="left"><div align="center"><a href="main.php">Back to Main</a></div></td></tr>
</table>
</form>
would carry the two variables ($random, and $user) into page register3.php
i made page register3.php so it only echos those variables to check if it worked nothing seems to appear... the code in page register3.php is..
   <?
   $random=$_GET['random'];
   $user=$_GET['user'];
     echo $user;
   echo $random;
     ?>
I also tried just putting
<? 
echo $_GET['$random'];
echo $_GET['$random'];        
            ?>
but it didn't work either..
well I must be doing something wrong or missing something... can some one help me..

PS.. if oyu were woundering.. $random was is generated each time page register2.php is loaded using
$random = $session->generateRandStr(8)
and variable $user was goten from page register1.php using
$user=$_POST['user'];


#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 24 April 2006 - 11:16 PM

<form action="register3.php?var1=$random&var2=$user" method="POST">
And thus the variables are var1 and var2, retrieved from the $_GET array (via URL not the form method) so:
$random = $_GET['var1'];
$user = $_GET['var2'];

Legend has it that reading the manual never killed anyone.
My site

#3 Dobakat

Dobakat
  • Members
  • PipPipPip
  • Advanced Member
  • 54 posts

Posted 24 April 2006 - 11:25 PM

is there a better way to carry varriables like this?

and I tried
            <? 
$random = $_GET['var1'];
$user = $_GET['var2'];
echo $user;
echo '<br>';
echo $random;
            ?>

and only got this as the result.. I got that, not the actual value of the variables.

$user
$random


#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 24 April 2006 - 11:31 PM

Well, I don't see why you want to carry some variables with the URL and other variables with the form inputs. You might just as well use 'hidden' inputs for them all and (assuming your form method stays as "post", retrieve them from the $_POST array once the form is submitted ... that works.
Legend has it that reading the manual never killed anyone.
My site

#5 sanfly

sanfly
  • Members
  • PipPipPip
  • Advanced Member
  • 344 posts
  • LocationNew Zealand

Posted 24 April 2006 - 11:33 PM

In your form your using "POST"

<form action="register3.php?var1=$random&var2=$user" method="POST">

But when you try and retrieve the variables, your using "$_GET"

Try this:

<?
   $random=$_POST['random'];
   $user=$_POST['user'];
     echo $user;
   echo $random;
     ?>

If you're not part of the solution, you're part of the precipitate

#6 Dobakat

Dobakat
  • Members
  • PipPipPip
  • Advanced Member
  • 54 posts

Posted 24 April 2006 - 11:41 PM

Well I tried as you said sanfly, but I got this..

Parse error: parse error, unexpected T_VARIABLE in /home/dobakat/public_html/members/register3.php on line 153

and line 153 is
  
   $random=$_POST['random'];


#7 sanfly

sanfly
  • Members
  • PipPipPip
  • Advanced Member
  • 344 posts
  • LocationNew Zealand

Posted 25 April 2006 - 12:03 AM

The error for unexpected t_variable ususally occurs on the lines before the line stated, and in my experience usually means i have missed out a ';'. Check your code before this line, if you cant find the problem, post the 5 lines of code before the line in the error.

by the way, just looking closer at your form tag:

<form action="register3.php?var1=$random&var2=$user" method="POST">

try this

<form action="register3.php" method="POST">


If you're not part of the solution, you're part of the precipitate

#8 Dobakat

Dobakat
  • Members
  • PipPipPip
  • Advanced Member
  • 54 posts

Posted 25 April 2006 - 12:13 AM

I tried finding the error, but I couldn't. I tried only runing this code
          
         <?
   $random=$_POST['random'];
   $user=$_POST['user'];
     echo $user;
   echo $random;
     ?>

but I still got an error on line 3..

and is I also changes what you suggested on the form tag.. but if I do that.. how will the to variables get ccarried..
I just realized that my two variables are not in the form.. is taht a mistake I am doing?

#9 sanfly

sanfly
  • Members
  • PipPipPip
  • Advanced Member
  • 344 posts
  • LocationNew Zealand

Posted 25 April 2006 - 12:41 AM

I just tested that little snippet of code only and got no errors. Are using include() at all (either including something beforehand or including the page with the script on some other page?)

[a href=\"http://www.tizag.com/phpT/forms.php\" target=\"_blank\"]check out this[/a] for a tutorial on post and get in php forms
If you're not part of the solution, you're part of the precipitate

#10 Dobakat

Dobakat
  • Members
  • PipPipPip
  • Advanced Member
  • 54 posts

Posted 25 April 2006 - 12:47 AM

Well i know how to use forms.. and I think thats were we I got confused, that form is just a button here is m code for the pages of register

PAGE ONE REGISTER.PHP
<?
include("include/session.php");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Istari Guild</title>
<link rel="STYLESHEET" href="/style.css" type="text/css">
<style type="text/css">
<!--
.style1 {
    font-size: 28px;
    color: FFBA27;
}
.style3 {color: #666666}
.style5 {font-size: 12px}
-->
</style></head>
<body bgcolor="FFFFFF">
<div align="center">
<table width="750" border="0" cellpadding="0" cellspacing="0">
 <tr>
  <td colspan="3" width="750">
   <table width="750" border="0" cellpadding="0" cellspacing="0">
    <tr>
     <td width="750" colspan="3"><span class="style1">Istari Guild </span></td>
    </tr>
    <tr>
     <td width="330">&quot;Together we stand, together we die!&quot; </td>
     <td width="400" align="right">
      <table width="400" border="0" cellpadding="0" cellspacing="0">
       <tr>
        <td align="right" height="20">
        <FORM ACTION="http://www.tibia.com/community/?subtopic=character" METHOD=post>
          <span class="style3">Search for Character</span>
  <INPUT NAME="name" VALUE=""SIZE=20 MAXLENGTH=29>
  <input name="Submit" type="submit" value="Search">
        </FORM>
  
       </tr>
      </table>
     </td>
     <td width="20"></td>
    </tr>
   </table>
  </td>
 </tr>
 <tr></tr>
 <tr>
  <td colspan="3" height="1" bgcolor="CCCCCC"></td>
 </tr>
 <tr>
  <td colspan="3" height="10" bgcolor="FFFFFF"></td>
 </tr>
 <tr>
  <td width="170" bgcolor="FFFFFF" valign="top">
  <span style="font-size:6px"><br></span>
  <div align="center">
   <table width="140" border="0" cellpadding="0" cellspacing="0">
    <tr>
     <td><?php 
include($_SERVER['DOCUMENT_ROOT'].'/menu.php'); 
?></td>
    </tr>
   </table>
   <br><span style="font-size:6px"><br></span>
   <table width="140" border="0" cellpadding="0" cellspacing="0">
    <tr>
     <td colspan="3" height="1" bgcolor="AAAAAA"></td>
    </tr>
    <tr>
     <td width="1" bgcolor="AAAAAA" rowspan="5"></td>
     <td width="138" height="26" bgcolor="F9F9F9" style="color:FFBA27;font-size:14px">
       <div align="center">&nbsp;Announcements
       </div></td>
     <td width="1" bgcolor="AAAAAA" rowspan="5"></td>
    </tr>
    <tr>
     <td height="1" bgcolor="AAAAAA"></td>
    </tr>
    <tr>
     <td bgcolor="FFFFFF">
      <table width="138" border="0" cellpadding="7" cellspacing="0">
       <tr>
        <td style="color:#666666"><div align="left">
          <?php 
include($_SERVER['DOCUMENT_ROOT'].'/announcements.php'); 
?>
        </div></td>
       </tr>
      </table>
     </td>
    </tr>
    <tr>
     <td height="1" bgcolor="AAAAAA"></td>
    </tr>
   </table>
   <br>
   <br>
   <p style="font-size:6px"><br>
    </p>
  </div>
  </td>
  <td width="1" bgcolor="CCCCCC"></td>
  <td width="579" valign="top">
  <span style="font-size:6px"><br></span>
  <div align="center">
    <table width="549" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td colspan="4" height="1" bgcolor="AAAAAA"></td>
        <td width="5" height="1" bgcolor="FFFFFF"></td>
      </tr>
      <tr>
        <td width="1" bgcolor="AAAAAA"></td>
        <td rowspan="2" colspan="2" width="542" height="27" bgcolor="F9F9F9" style="color:FFBA27;font-size:15px">&nbsp;&nbsp;Welcome!</td>
        <td width="1" bgcolor="AAAAAA"></td>
        <td width="5" height="4" bgcolor="FFFFFF"></td>
      </tr>
      <tr>
        <td width="1" bgcolor="AAAAAA"></td>
        <td width="1" bgcolor="AAAAAA"></td>
        <td width="5" bgcolor="F0F0F0" height="23"></td>
      </tr>
      <tr>
        <td width="1" bgcolor="AAAAAA"></td>
        <td colspan="2" height="1" bgcolor="AAAAAA"></td>
        <td width="1" bgcolor="AAAAAA"></td>
        <td width="5" bgcolor="F0F0F0"></td>
      </tr>
      <tr>
        <td width="1" height="206" bgcolor="AAAAAA"></td>
        <td colspan="2" bgcolor="FFFFFF"><table width="542" border="0" cellpadding="17" cellspacing="0">
            <tr>
              <td style="color:#666666;line-height:1.6em"><div align="justify">
           <p>
<?
/**
 * The user is already logged in, not allowed to register.
 */
if($session->logged_in){
   echo "<h1>Registered</h1>";
   echo "<p>We're sorry <b>$session->username</b>, but you've already registered. "
       ."<a href=\"main.php\">Main</a>.</p>";
}


?>
<h1>Register Step (1)</h1>
<p>
  
  <br>
  <span class="style5">In order to register a character in Istariguild.com, you need to own a character in Tibia.(www.tibia.com)</span></p>
<form action="register2.php" method="POST">
<table align="left" border="0" cellspacing="0" cellpadding="3">
<tr><td>Character's name:</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr>
<tr><td colspan="2" align="right">
<input type="hidden" name="subjoin" value="1">
<input type="submit" value="Next"></td></tr>
<tr><td colspan="2" align="left"><a href="main.php">Back to Main</a></td></tr>
</table>
</form>

</p>
              </div></td>
            </tr>
        </table></td>
        <td width="1" bgcolor="AAAAAA"></td>
        <td width="5" bgcolor="F0F0F0"></td>
      </tr>
      <tr>
        <td width="1" bgcolor="AAAAAA"></td>
        <td colspan="2" height="1" bgcolor="AAAAAA"></td>
        <td width="1" bgcolor="AAAAAA"></td>
        <td width="5" bgcolor="F0F0F0"></td>
      </tr>
      <tr>
        <td width="1" height="5" bgcolor="FFFFFF"></td>
        <td width="4" height="5" bgcolor="FFFFFF"></td>
        <td width="538" height="5" bgcolor="F0F0F0"></td>
        <td width="1" height="5" bgcolor="F0F0F0"></td>
        <td width="5" height="5" bgcolor="F0F0F0"></td>
      </tr>
    </table>
    <span style="font-size:6px"><br>
   </span>
  </div>
  </td>
 </tr>
 <tr>
  <td colspan="3" height="10" bgcolor="FFFFFF"></td>
 </tr>
 <tr>
  <td colspan="3" height="1" bgcolor="CCCCCC"></td>
 </tr>
 <tr>
  <td colspan="3" height="5" bgcolor="FFFFFF"></td>
 </tr>
 <tr>
  <td colspan="3" bgcolor="FFFFFF" align="right"><p>Copyright © 2006, <strong>Dobakat</strong></a>. All Rights Reserved.<br> 
      The only official site of Tibia is <strong>www.tibia.com</strong>.<br>
      Tibia is a copyright of CipSoft GmbH, 2006.</p>
    </td>
 </tr>
</table>
</div>
</body>
</html>

PAGE TWO REGISTER2.PHP
<?
include("include/session.php");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Istari Guild</title>
<link rel="STYLESHEET" href="/style.css" type="text/css">
<style type="text/css">
<!--
.style1 {
    font-size: 28px;
    color: FFBA27;
}
.style3 {color: #666666}
.style5 {font-size: 12px}
-->
</style></head>
<body bgcolor="FFFFFF">
<div align="center">
<table width="750" border="0" cellpadding="0" cellspacing="0">
 <tr>
  <td colspan="3" width="750">
   <table width="750" border="0" cellpadding="0" cellspacing="0">
    <tr>
     <td width="750" colspan="3"><span class="style1">Istari Guild </span></td>
    </tr>
    <tr>
     <td width="330">&quot;Together we stand, together we die!&quot; </td>
     <td width="400" align="right">
      <table width="400" border="0" cellpadding="0" cellspacing="0">
       <tr>
        <td align="right" height="20">
        <FORM ACTION="http://www.tibia.com/community/?subtopic=character" METHOD=post>
          <span class="style3">Search for Character</span>
  <INPUT NAME="name" VALUE=""SIZE=20 MAXLENGTH=29>
  <input name="Submit" type="submit" value="Search">
        </FORM>
  
       </tr>
      </table>
     </td>
     <td width="20"></td>
    </tr>
   </table>
  </td>
 </tr>
 <tr></tr>
 <tr>
  <td colspan="3" height="1" bgcolor="CCCCCC"></td>
 </tr>
 <tr>
  <td colspan="3" height="10" bgcolor="FFFFFF"></td>
 </tr>
 <tr>
  <td width="170" bgcolor="FFFFFF" valign="top">
  <span style="font-size:6px"><br></span>
  <div align="center">
   <table width="140" border="0" cellpadding="0" cellspacing="0">
    <tr>
     <td><?php 
include($_SERVER['DOCUMENT_ROOT'].'/menu.php'); 
?></td>
    </tr>
   </table>
   <br><span style="font-size:6px"><br></span>
   <table width="140" border="0" cellpadding="0" cellspacing="0">
    <tr>
     <td colspan="3" height="1" bgcolor="AAAAAA"></td>
    </tr>
    <tr>
     <td width="1" bgcolor="AAAAAA" rowspan="5"></td>
     <td width="138" height="26" bgcolor="F9F9F9" style="color:FFBA27;font-size:14px">
       <div align="center">&nbsp;Announcements
       </div></td>
     <td width="1" bgcolor="AAAAAA" rowspan="5"></td>
    </tr>
    <tr>
     <td height="1" bgcolor="AAAAAA"></td>
    </tr>
    <tr>
     <td bgcolor="FFFFFF">
      <table width="138" border="0" cellpadding="7" cellspacing="0">
       <tr>
        <td style="color:#666666"><div align="left">
          <?php 
include($_SERVER['DOCUMENT_ROOT'].'/announcements.php'); 
?>
        </div></td>
       </tr>
      </table>
     </td>
    </tr>
    <tr>
     <td height="1" bgcolor="AAAAAA"></td>
    </tr>
   </table>
   <br>
   <br>
   <p style="font-size:6px"><br>
    </p>
  </div>
  </td>
  <td width="1" bgcolor="CCCCCC"></td>
  <td width="579" valign="top">
  <span style="font-size:6px"><br></span>
  <div align="center">
    <table width="549" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td colspan="4" height="1" bgcolor="AAAAAA"></td>
        <td width="5" height="1" bgcolor="FFFFFF"></td>
      </tr>
      <tr>
        <td width="1" bgcolor="AAAAAA"></td>
        <td rowspan="2" colspan="2" width="542" height="27" bgcolor="F9F9F9" style="color:FFBA27;font-size:15px">&nbsp;&nbsp;Welcome!</td>
        <td width="1" bgcolor="AAAAAA"></td>
        <td width="5" height="4" bgcolor="FFFFFF"></td>
      </tr>
      <tr>
        <td width="1" bgcolor="AAAAAA"></td>
        <td width="1" bgcolor="AAAAAA"></td>
        <td width="5" bgcolor="F0F0F0" height="23"></td>
      </tr>
      <tr>
        <td width="1" bgcolor="AAAAAA"></td>
        <td colspan="2" height="1" bgcolor="AAAAAA"></td>
        <td width="1" bgcolor="AAAAAA"></td>
        <td width="5" bgcolor="F0F0F0"></td>
      </tr>
      <tr>
        <td width="1" height="206" bgcolor="AAAAAA"></td>
        <td colspan="2" bgcolor="FFFFFF"><table width="542" border="0" cellpadding="17" cellspacing="0">
            <tr>
              <td style="color:#666666;line-height:1.6em"><div align="justify">
                  <p><?
/**
 * The user is already logged in, not allowed to register.
 */
if($session->logged_in){
   echo "<h1>Registered</h1>";
   echo "<p>We're sorry <b>$session->username</b>, but you've already registered. "
       ."<a href=\"main.php\">Main</a>.</p>";
}

  $user=$_POST['user'];
  
   $random = $session->generateRandStr(8)
?>
<h1>Register Step (2) <span class="style5"></span></h1>
<p><span class="style5">Now, to demonstrate that you own <strong> <? echo $user; ?> </strong> you only have to edit your profile in www.tibia.com and add the following code to your character description (comment):</span></p>

<p align="center"><strong><span class="style5"> <strong> <? echo $random; ?> </strong>
  <br>

<span class="style5">(This is not your password)</span></strong></p>


<p align="left"><span class="style5"><br>
  </span><span class="style5">Here are some intructions in case you don't know how to do it.
  <br>
  &bull;     Go to Tibia homepage and login there (www.tibia.com).<br>
  &bull;     Edit your character description (Characters ... Edit)<br>
  &bull;     Write the code as part of the comments (Comments)<br>
  &bull;     Save the changes (Submit)<br>
    &bull;Press this button when you have done it.</span></p>
 <form action="register3.php" method="POST">
<table align="center" border="0" cellspacing="0" cellpadding="3">
<tr><td width="240" align="right">
  <div align="center">
  <input type="hidden" name="subjoin" value="1">
  <input type="submit" value="Next">
  </div></td></tr>
<tr><td align="left"><div align="center"><a href="main.php">Back to Main</a></div></td></tr>
</table>
</form>

</p>
              </div></td>
            </tr>
        </table></td>
        <td width="1" bgcolor="AAAAAA"></td>
        <td width="5" bgcolor="F0F0F0"></td>
      </tr>
      <tr>
        <td width="1" bgcolor="AAAAAA"></td>
        <td colspan="2" height="1" bgcolor="AAAAAA"></td>
        <td width="1" bgcolor="AAAAAA"></td>
        <td width="5" bgcolor="F0F0F0"></td>
      </tr>
      <tr>
        <td width="1" height="5" bgcolor="FFFFFF"></td>
        <td width="4" height="5" bgcolor="FFFFFF"></td>
        <td width="538" height="5" bgcolor="F0F0F0"></td>
        <td width="1" height="5" bgcolor="F0F0F0"></td>
        <td width="5" height="5" bgcolor="F0F0F0"></td>
      </tr>
    </table>
    <span style="font-size:6px"><br>
   </span>
  </div>
  </td>
 </tr>
 <tr>
  <td colspan="3" height="10" bgcolor="FFFFFF"></td>
 </tr>
 <tr>
  <td colspan="3" height="1" bgcolor="CCCCCC"></td>
 </tr>
 <tr>
  <td colspan="3" height="5" bgcolor="FFFFFF"></td>
 </tr>
 <tr>
  <td colspan="3" bgcolor="FFFFFF" align="right"><p>Copyright © 2006, <strong>Dobakat</strong></a>. All Rights Reserved.<br> 
      The only official site of Tibia is <strong>www.tibia.com</strong>.<br>
      Tibia is a copyright of CipSoft GmbH, 2006.</p>
    </td>
 </tr>
</table>
</div>
</body>
</html>

PAGE 3.. REGISTER3.PHP
<?
include("include/session.php");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Istari Guild</title>
<link rel="STYLESHEET" href="/style.css" type="text/css">
<style type="text/css">
<!--
.style1 {
    font-size: 28px;
    color: FFBA27;
}
.style3 {color: #666666}
.style5 {font-size: 12px}
-->
</style></head>
<body bgcolor="FFFFFF">
<div align="center">
<table width="750" border="0" cellpadding="0" cellspacing="0">
 <tr>
  <td colspan="3" width="750">
   <table width="750" border="0" cellpadding="0" cellspacing="0">
    <tr>
     <td width="750" colspan="3"><span class="style1">Istari Guild </span></td>
    </tr>
    <tr>
     <td width="330">&quot;Together we stand, together we die!&quot; </td>
     <td width="400" align="right">
      <table width="400" border="0" cellpadding="0" cellspacing="0">
       <tr>
        <td align="right" height="20">
        <FORM ACTION="http://www.tibia.com/community/?subtopic=character" METHOD=post>
          <span class="style3">Search for Character</span>
  <INPUT NAME="name" VALUE=""SIZE=20 MAXLENGTH=29>
  <input name="Submit" type="submit" value="Search">
        </FORM>
  
       </tr>
      </table>
     </td>
     <td width="20"></td>
    </tr>
   </table>
  </td>
 </tr>
 <tr></tr>
 <tr>
  <td colspan="3" height="1" bgcolor="CCCCCC"></td>
 </tr>
 <tr>
  <td colspan="3" height="10" bgcolor="FFFFFF"></td>
 </tr>
 <tr>
  <td width="170" bgcolor="FFFFFF" valign="top">
  <span style="font-size:6px"><br></span>
  <div align="center">
   <table width="140" border="0" cellpadding="0" cellspacing="0">
    <tr>
     <td><?php 
include($_SERVER['DOCUMENT_ROOT'].'/menu.php'); 
?></td>
    </tr>
   </table>
   <br><span style="font-size:6px"><br></span>
   <table width="140" border="0" cellpadding="0" cellspacing="0">
    <tr>
     <td colspan="3" height="1" bgcolor="AAAAAA"></td>
    </tr>
    <tr>
     <td width="1" bgcolor="AAAAAA" rowspan="5"></td>
     <td width="138" height="26" bgcolor="F9F9F9" style="color:FFBA27;font-size:14px">
       <div align="center">&nbsp;Announcements
       </div></td>
     <td width="1" bgcolor="AAAAAA" rowspan="5"></td>
    </tr>
    <tr>
     <td height="1" bgcolor="AAAAAA"></td>
    </tr>
    <tr>
     <td bgcolor="FFFFFF">
      <table width="138" border="0" cellpadding="7" cellspacing="0">
       <tr>
        <td style="color:#666666"><div align="left">
          <?php 
include($_SERVER['DOCUMENT_ROOT'].'/announcements.php'); 
?>
        </div></td>
       </tr>
      </table>
     </td>
    </tr>
    <tr>
     <td height="1" bgcolor="AAAAAA"></td>
    </tr>
   </table>
   <br>
   <br>
   <p style="font-size:6px"><br>
    </p>
  </div>
  </td>
  <td width="1" bgcolor="CCCCCC"></td>
  <td width="579" valign="top">
  <span style="font-size:6px"><br></span>
  <div align="center">
    <table width="549" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td colspan="4" height="1" bgcolor="AAAAAA"></td>
        <td width="5" height="1" bgcolor="FFFFFF"></td>
      </tr>
      <tr>
        <td width="1" bgcolor="AAAAAA"></td>
        <td rowspan="2" colspan="2" width="542" height="27" bgcolor="F9F9F9" style="color:FFBA27;font-size:15px">&nbsp;&nbsp;Welcome!</td>
        <td width="1" bgcolor="AAAAAA"></td>
        <td width="5" height="4" bgcolor="FFFFFF"></td>
      </tr>
      <tr>
        <td width="1" bgcolor="AAAAAA"></td>
        <td width="1" bgcolor="AAAAAA"></td>
        <td width="5" bgcolor="F0F0F0" height="23"></td>
      </tr>
      <tr>
        <td width="1" bgcolor="AAAAAA"></td>
        <td colspan="2" height="1" bgcolor="AAAAAA"></td>
        <td width="1" bgcolor="AAAAAA"></td>
        <td width="5" bgcolor="F0F0F0"></td>
      </tr>
      <tr>
        <td width="1" height="206" bgcolor="AAAAAA"></td>
        <td colspan="2" bgcolor="FFFFFF"><table width="542" border="0" cellpadding="17" cellspacing="0">
            <tr>
              <td style="color:#666666;line-height:1.6em"><div align="justify">
                  <p><?
/**
 * The user is already logged in, not allowed to register.
 */
if($session->logged_in){
   echo "<h1>Registered</h1>";
   echo "<p>We're sorry <b>$session->username</b>, but you've already registered. "
       ."<a href=\"main.php\">Main</a>.</p>";
}

 
?>
<h1>Register Step (3) <span class="style5"></span></h1>
<p>

            
         <?
   $random=$_POST['random'];
   $user=$_POST['user'];
     echo $user;
   echo $random;
     ?>





</p>

</p>
              </div></td>
            </tr>
        </table></td>
        <td width="1" bgcolor="AAAAAA"></td>
        <td width="5" bgcolor="F0F0F0"></td>
      </tr>
      <tr>
        <td width="1" bgcolor="AAAAAA"></td>
        <td colspan="2" height="1" bgcolor="AAAAAA"></td>
        <td width="1" bgcolor="AAAAAA"></td>
        <td width="5" bgcolor="F0F0F0"></td>
      </tr>
      <tr>
        <td width="1" height="5" bgcolor="FFFFFF"></td>
        <td width="4" height="5" bgcolor="FFFFFF"></td>
        <td width="538" height="5" bgcolor="F0F0F0"></td>
        <td width="1" height="5" bgcolor="F0F0F0"></td>
        <td width="5" height="5" bgcolor="F0F0F0"></td>
      </tr>
    </table>
    <span style="font-size:6px"><br>
   </span>
  </div>
  </td>
 </tr>
 <tr>
  <td colspan="3" height="10" bgcolor="FFFFFF"></td>
 </tr>
 <tr>
  <td colspan="3" height="1" bgcolor="CCCCCC"></td>
 </tr>
 <tr>
  <td colspan="3" height="5" bgcolor="FFFFFF"></td>
 </tr>
 <tr>
  <td colspan="3" bgcolor="FFFFFF" align="right"><p>Copyright © 2006, <strong>Dobakat</strong></a>. All Rights Reserved.<br> 
      The only official site of Tibia is <strong>www.tibia.com</strong>.<br>
      Tibia is a copyright of CipSoft GmbH, 2006.</p>
    </td>
 </tr>
</table>
</div>
</body>
</html>


what I really wanted from the begging was to carry variables $random and $user from page 2 to page 3..

#11 sanfly

sanfly
  • Members
  • PipPipPip
  • Advanced Member
  • 344 posts
  • LocationNew Zealand

Posted 25 April 2006 - 01:06 AM

So in the form on register2.php

<form action="register3.php" method="POST">
<table align="center" border="0" cellspacing="0" cellpadding="3">
<tr><td width="240" align="right">
  <div align="center">
  <input type="hidden" name="subjoin" value="1">
  <input type="submit" value="Next">
  </div></td></tr>
<tr><td align="left"><div align="center"><a href="main.php">Back to Main</a></div></td></tr>
</table>
</form>

you need to add fields for user and random

eg:

<form action="register3.php" method="POST">
    <table align="center" border="0" cellspacing="0" cellpadding="3">
        <tr>
            <td width="240" align="right">
                  <div align="center">
                      <input type="hidden" name="subjoin" value="1">
                    <input type="hidden" name="user" value="<?=$user?>">
                    <input type="hidden" name="random" value="<?=$random?>">
                      <input type="submit" value="Next">
                  </div>
            </td>
        </tr>
        <tr>
            <td align="left">
                <div align="center"><a href="main.php">Back to Main</a></div>
            </td>
        </tr>
    </table>
</form>




If you're not part of the solution, you're part of the precipitate

#12 Dobakat

Dobakat
  • Members
  • PipPipPip
  • Advanced Member
  • 54 posts

Posted 25 April 2006 - 01:21 AM

Well I apreciated the help, but it is not working anymore.
I change the code of page 3 to just
<?
   $random=$_POST['random'];
   $user=$_POST['user'];
     echo $user;
   echo $random;
     ?>

aand I get an error
Parse error: parse error, unexpected T_VARIABLE in /home/dobakat/public_html/members/register3.php on line 2
I don't see anything wrong though..

#13 sanfly

sanfly
  • Members
  • PipPipPip
  • Advanced Member
  • 344 posts
  • LocationNew Zealand

Posted 25 April 2006 - 01:31 AM

and if you delete that little segment of code in the page as you have it now, does the error disappear?
If you're not part of the solution, you're part of the precipitate

#14 Dobakat

Dobakat
  • Members
  • PipPipPip
  • Advanced Member
  • 54 posts

Posted 25 April 2006 - 02:18 AM

If I delete that line and just leave
<?
 
   $user=$_POST['user'];
     echo $user;
   echo $random;
     ?>
I still get tat error oon line 3.. which is..
  $user=$_POST['user'];


#15 Dobakat

Dobakat
  • Members
  • PipPipPip
  • Advanced Member
  • 54 posts

Posted 25 April 2006 - 09:33 PM

I haven't fixed my problem. Can someone help me? I am only trying to carry variables using hidde variables in a page.. but it does not work.

#16 Ozz18

Ozz18
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 26 April 2006 - 03:26 PM

Hey

Try this

<form method="POST" action="page.php">
<input type=hidden name=username value="<?php echo $username ?>" >
</form>

this will add a variable named username with the value of $username
[notice that the $username had to b inside <?php ?>]

then on the next page, access the variable using

<?php
$username = $_POST['username'];
?>

hope this works for you.
anyway, let me know.

cheers




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users