papillonstudios Posted July 29, 2009 Share Posted July 29, 2009 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 More sharing options...
corbin Posted July 29, 2009 Share Posted July 29, 2009 ..... What's in your anchor function? Link to comment https://forums.phpfreaks.com/topic/167909-passing-variable-data-between-pages/#findComment-885629 Share on other sites More sharing options...
smerny Posted July 29, 2009 Share Posted July 29, 2009 try this echo "Click the link to go to Step 2 <a href='index.php?step=step2&host=".$host."&db=".$db."&dbuser=".$dbuser."&dbpass=".dbpass."'>Continue -></a>"; but as for the user/pass etc... have you looked into sessions? Link to comment https://forums.phpfreaks.com/topic/167909-passing-variable-data-between-pages/#findComment-885630 Share on other sites More sharing options...
papillonstudios Posted July 29, 2009 Author Share Posted July 29, 2009 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. Link to comment https://forums.phpfreaks.com/topic/167909-passing-variable-data-between-pages/#findComment-885631 Share on other sites More sharing options...
papillonstudios Posted July 29, 2009 Author Share Posted July 29, 2009 ok its passing the data through and im using $GET to egt the info buts its not getting it. Whats wrong? Link to comment https://forums.phpfreaks.com/topic/167909-passing-variable-data-between-pages/#findComment-885634 Share on other sites More sharing options...
smerny Posted July 29, 2009 Share Posted July 29, 2009 $_GET['db'] for example? Link to comment https://forums.phpfreaks.com/topic/167909-passing-variable-data-between-pages/#findComment-885636 Share on other sites More sharing options...
papillonstudios Posted July 29, 2009 Author Share Posted July 29, 2009 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 Link to comment https://forums.phpfreaks.com/topic/167909-passing-variable-data-between-pages/#findComment-885640 Share on other sites More sharing options...
papillonstudios Posted July 29, 2009 Author Share Posted July 29, 2009 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 ->'); } ?> Link to comment https://forums.phpfreaks.com/topic/167909-passing-variable-data-between-pages/#findComment-885651 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.