jonoc33 Posted November 28, 2007 Share Posted November 28, 2007 Hey guys <?php $con = mysql_connect("localhost","jonoc33","***"); if (!$con) die('Could not connect: ' . mysql_error()); mysql_select_db("revolutiongamerz_net_-_clansolutions", $con); $sql="INSERT INTO emails (accid, email, redirectto, activated) VALUES ('" . $_POST["accid"] . "','" . $_POST["q1_E-mail"] . "','" . $_POST["q9_Redirectto"] . "','0')"; $rs = mysql_query($sql) or die ("Problem with the query: $sql <br>" . mysql_error); echo "<center>Email added."; echo "<center><a href=emails.php>Back</a>"; ?> This is my code for adding something to a database. Note $_POST accid. On the previous page I have a hidden field called accid. In it, I need to display a session name that I am using for a login system. The session name is client_id. <input name="accid" type="hidden" class="text " id="accid" value="" size="20" /> What would I add in value="" to make this work? Link to comment https://forums.phpfreaks.com/topic/79227-solved-adding-something-to-a-db-the-id-being-a-session-name/ Share on other sites More sharing options...
Dane Posted November 28, 2007 Share Posted November 28, 2007 value="<?php echo $HTTP_SESSION_VARS['session_name']; ?>" i think Link to comment https://forums.phpfreaks.com/topic/79227-solved-adding-something-to-a-db-the-id-being-a-session-name/#findComment-401009 Share on other sites More sharing options...
jonoc33 Posted November 28, 2007 Author Share Posted November 28, 2007 Awesome, that worked. Now how exactly would I display that? This is what I put. <? include("inc/dbconnect.php"); $results = mysql_query("SELECT email, redirectto, activated FROM emails WHERE accid = "$HTTP_SESSION_VARS['client_id']""); while($values = mysql_fetch_array($results)){ echo $values['email']." redirects to ".$values['redirectto']."<br />"; echo $values['activated'] != 1 ? "Not Activated" : "Activated"; echo "<p>"; } ?> That didn't work. Seems to appear right through the word colouring though. Link to comment https://forums.phpfreaks.com/topic/79227-solved-adding-something-to-a-db-the-id-being-a-session-name/#findComment-401011 Share on other sites More sharing options...
~n[EO]n~ Posted November 28, 2007 Share Posted November 28, 2007 value="<?php echo $HTTP_SESSION_VARS['session_name']; ?>" i think $HTTP_SESSION_VARS is deprecated use $_SESSION['session_name']; $HTTP_SESSION_VARS for PHP 4.0.6 or less Link to comment https://forums.phpfreaks.com/topic/79227-solved-adding-something-to-a-db-the-id-being-a-session-name/#findComment-401012 Share on other sites More sharing options...
jonoc33 Posted November 28, 2007 Author Share Posted November 28, 2007 Ok fixed it all up. Everythings working now. Thanks guys Link to comment https://forums.phpfreaks.com/topic/79227-solved-adding-something-to-a-db-the-id-being-a-session-name/#findComment-401017 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.