Page 1 of 1
session email id
Posted: Fri Mar 10, 2017 7:59 am
by sardar_sajjad
Dear Reader
How can I catch session id if it is email id in custom files and also is it possible to insert value from customer file to new table in database?
under customer file>test.php>custom templates>contents I am using
$c_email=$_SESSION['email'];
but I am not able to get session email(its also the user name to login) in variable $c_email
Need your help.
Thanks
Sajjad
Re: session email id
Posted: Fri Mar 10, 2017 9:45 am
by mobhar
Assume you've already setup "Email" as "User ID Security" from "Advanced Security", then you may simply use:
Security()->SessionUserID()
Re: session email id
Posted: Fri Mar 10, 2017 8:33 pm
by sardar_sajjad
Dear Mobhar
Thank you for the support. I am able to get session ID as per your advise. in same question at second phase after get record form 1 table or session I want to insert same record on 2nd table but when I click submit button in my custom file it is not getting any action.
below is the little code for your reference.
<td colspan="2"><input type="submit" name="confirm_insert" value="Confirm" /> </td>
<?php
$con = mysqli_connect ("localhost","root","","promo");
if(isset($POST['confirm_insert'])){
//text data variables
$sale_id = $POST['sal_id'];
$user_id = $_POST['user_id'];
$p_insert = "insert into promoin (sale_id,u_id) values ('$sale_id','$user_id')";
$run_p= mysqli_query($con, $p_insert);
if($run_p){
echo"<script>alert ('Promoin Inserted Succesfully')</script>";
}
}
?>
Note: the custom file name is test3.php, also i didn't found any form (<from.......> </form>) tag option in customer file settings. because on submit and insert form tag required.
Your help required.
Thanks
Sajjad
Re: session email id
Posted: Mon Mar 13, 2017 9:23 am
by mobhar
Then make sure you have already included the "<form ...> </form>" tags in your Custom Files.
Re: session email id
Posted: Mon Mar 13, 2017 11:49 am
by sardar_sajjad
Hi,
Thank you it's ok now.
Sajjad