Jump to content

Passing variable Data Between Pages


papillonstudios

Recommended Posts

i would like to pass variable data between pages. and i mean like the data from a variable, since the information i want to pass is dynamic.

 

This is what i cam up with

 

echo 'Click the link to go to Step 2 ' . anchor ('index.php?step=step2&host='.$host.'&db='.$db&'dbuser='.$dbuser.'&dbpass='.$dbpass.'', 'Continue ->');

 

but it out puts

 

Click the link to go to Step 2 <a href="%60bda%60" 0``="" p$d`0apa02&hd="">Continue -></a>

 

whats the right way to do it?

Link to comment
https://forums.phpfreaks.com/topic/167909-passing-variable-data-between-pages/
Share on other sites

i was looking over it again after i posted it, and it i misplaced a period. I haven't looked into sessions yet. But this is not going to be final i will evolve this.

 

Im creating a install system for my cms and i want to pass through all the database info through but in a later version i will look into sessions.

its not selecting the database but it is connecting to the server

 

I forgot that when the admin completes step 1 i have the script create a file called efs.php that stores the db connection settings but that doesn't help. I have even set $db to test and it doesn't wanna connect

i just echoed the DB_NAME contant that hold the the Databse Name and it echoes test.

 

So it is in ther but its not connecting, WHy?

 

Heres my code

 

<?php

include ('defs.php');

if (!defined('error_check')) die('You Cannot Access This Page From This Location');

//If the form hasn't been submitted, show it.
      if (!isset($_POST['post'])) {

?>

<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post">
   <input type="hidden" value="1" name="post" />
   <input type="hidden" value="2.0.2" name="version" />
    <table width="75%">
   <? echo DB_NAME; ?>
        <tr><td>Sitename </td><td><input type="text" class="input" name="sitename" /></td></tr>
       
        <tr><td>Site URL </td><td><input type="text" class="input" name="siteurl" /></td></tr>
       
        <tr><td>Site Description </td><td><p><textarea name="textarea" cols="40" rows="10" class="input" name="sitedesc"></textarea></p></td></tr>
             
        <tr><td><input type="submit" class="input" name="submit" value="Continue ->" /></td></tr>
       
     </table>

</form>

<?php

        }
        //Or else it has been submitted...
        else {
            //Get information from the forms secure it all.
         
	 $version = secure($_POST['version']);
         $sitename= secure($_POST['sitename']);
         $siteurl = secure($_POST['siteurl']);
         $sitedesc = secure($_POST['sitedesc']);
	 $host= secure(DB_HOST);
         $db = secure(DB_NAME);
         $dbuser = secure(DB_USER);
         $dbpass = secure(DB_PASSWORD);

      
        $connect = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
         
         if (!connect)
   	     {
	 die('Could not connect: ' . mysql_error());
     }
                
            $select = mysql_select_db(DB_NAME);
            
               if (!$select)
		   {
		   die('Could not Select: ' . mysql_error());
		   }
                  
                   $info = "INSERT INTO `info` (`version`, `sitename`, `siteurl`, `sitedesc`) VALUES ('2.0.2', '$sitename', '$siteurl', '$sitedesc');
                              ";
			  
			  mysql_query($info) or die ('Couldn\'t insert Data' . mysql_error());
                  
             
                  echo 'Click the link to go to Step 3 ' .anchor ('index.php?step=step3', 'Continue ->');

}


?>

Archived

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

×
×
  • 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.