New Zenner
- Join Date:
- Dec 2009
- Posts:
- 13
- Plugin Contributions:
- 0
Fetch user email address from database
Hello,
I have a web page that needs to fetch the current users email address from the database and put it in a form.
How can I do this?
Views: 1,333
New Zenner
Hello,
I have a web page that needs to fetch the current users email address from the database and put it in a form.
How can I do this?
New Zenner
I was thinking that since the users login name is his email address I could just capture that login name, set it as a cookie
something like setcookie( "username", $this->customer['email_address']); and then retrieve the cookie into the form on the static page.
Cant figure out how to capture the login name though.
Im not sure how zen cart stores current logged in user status. Does it have the user login in a global variable of some sort i can access it from?
Sensei
hoehnt:
Hello,
I have a web page that needs to fetch the current users email address from the database and put it in a form.
How can I do this?
Is this "web page" a Zen Cart page? If so, just use $_SESSION['customers_email_address']
New Zenner
DrByte:
Is this "web page" a Zen Cart page? If so, just use $_SESSION['customers_email_address']
Its a static page inserted into my Zen Cart custom template.
New Zenner
Shouldnt I be able to do something like:
<INPUT name="useremail" type= "hidden" value="<?=$_SESSION['customers_email_address']?>">Sensei
While I wouldn't recommend using short-tags, yes the concept is correct, as long as you're in a Zen Cart page.
Or, rather than using some 3rd-party tool for collecting form data, why not use Zen Cart's own forms? Or maybe an addon such as the one discussed here: http://www.zen-cart.com/forum/showthread.php?t=4855
New Zenner
Tried putting this in tpl_header_default.php and at the top of the static page where it should be loaded (first page after user logs in)
Doesnt appear to do anything.
I am checking the cookies by entering javascript:alert(document.cookie); in my browser address bar.
What zen cart file would you recommend putting it in?
Tell staff why this post should be reviewed.