Jump to content

Archived

This topic is now archived and is closed to further replies.

Dobakat

Carrying variables.

Recommended Posts

Well I thought that this form
[code]
<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>
[/code]
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..
[code]
   <?
   $random=$_GET['random'];
   $user=$_GET['user'];
     echo $user;
   echo $random;
     ?>
[/code]
I also tried just putting
[code]
<?
echo $_GET['$random'];
echo $_GET['$random'];        
            ?>
[/code]
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
[code]
$random = $session->generateRandStr(8)
[/code]
and variable $user was goten from page register1.php using
[code]
$user=$_POST['user'];
[/code]

Share this post


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

Share this post


Link to post
Share on other sites
is there a better way to carry varriables like this?

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

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

[code]
$user
$random[/code]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
In your form your using "POST"

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

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

Try this:

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

Share this post


Link to post
Share on other sites
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
  [code]
   $random=$_POST['random'];
[/code]

Share this post


Link to post
Share on other sites
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:

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

try this

[code] <form action="register3.php" method="POST">[/code]

Share this post


Link to post
Share on other sites
I tried finding the error, but I couldn't. I tried only runing this code
[code]          
         <?
   $random=$_POST['random'];
   $user=$_POST['user'];
     echo $user;
   echo $random;
     ?>
[/code]
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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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
[code]<?
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>[/code]
PAGE TWO REGISTER2.PHP
[code]<?
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>[/code]
PAGE 3.. REGISTER3.PHP
[code]<?
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>[/code]

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

Share this post


Link to post
Share on other sites
So in the form on register2.php

[code]<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>[/code]

you need to add fields for user and random

eg:

[code]<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>[/code]



Share this post


Link to post
Share on other sites
Well I apreciated the help, but it is not working anymore.
I change the code of page 3 to just
[code]<?
   $random=$_POST['random'];
   $user=$_POST['user'];
     echo $user;
   echo $random;
     ?>[/code]
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..

Share this post


Link to post
Share on other sites
and if you delete that little segment of code in the page as you have it now, does the error disappear?

Share this post


Link to post
Share on other sites
If I delete that line and just leave
[code]
<?
 
   $user=$_POST['user'];
     echo $user;
   echo $random;
     ?>[/code]
I still get tat error oon line 3.. which is..
  $user=$_POST['user'];

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

×

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.