gongpex Posted October 20, 2012 Share Posted October 20, 2012 Hello everyone, I think all of you understand if on index.php we use include taqs so that when user open another link for example : shop it will show like this on address bar : index.php?page=shop. Of course to show it I need to make file like this content_shop.php. But if I create file like this , when I using session_start() the session won't work. for example : If I buy product on page content_product.php and product shown to content_basket.php Therefore I create basket.php or buy.php so that the session and header can be works. please see this image : Q : Actually can I using session , if index.php file using include taq ?(directly on form action="index.php?page=basket" not basket.php at content_product.php please see on image above) N : header taqs same too won't work if I use it on content_product.php or etc please help me Thanks_______________________________________________________________________________________________ N : This question still have correlation with my previous post Link to comment Share on other sites More sharing options...
kanchatchai Posted October 20, 2012 Share Posted October 20, 2012 may use...action= "content_product.php" then ....in "content_product.php" check if $_POST['submit'] include('basket.php') Link to comment Share on other sites More sharing options...
kanchatchai Posted October 20, 2012 Share Posted October 20, 2012 can use more than one button submit like delete button on content_product.php in one formsample <form id="form1" name="form1" method="POST" action=""> <label> <input type="submit" name="a" value="a" /> </label> <input type="submit" name="b" value="b" /> <input type="submit" name="c" value="c" /></form><?PHPif (isset($_POST['a'])) { echo 'action=a';}if (isset($_POST['b'])) { echo 'action=b';}if (isset($_POST['c'])) {echo 'action=c';//include('tets.php');}?> Link to comment Share on other sites More sharing options...
kanchatchai Posted October 20, 2012 Share Posted October 20, 2012 if session not workmove <?PHPsession_start(); to first of fileand encode to utf8 without BOM(I use notepad++ to do this in menu encoding) Link to comment Share on other sites More sharing options...
kanchatchai Posted October 21, 2012 Share Posted October 21, 2012 (edited) some of problem $_SESSION["session_name"];// <---- THIS WORK$_SESSION['session_name'];// <---- THIS WORK$_session["session_name"];// <---- this not work$_session[session_name];// <---- this not work$_SESSION[session_name];// <---- this not work $_POST["var"];// <----THIS WORK$_POST['var'];// <----THIS WORK$_POST[var];// <---- this not work$_post["var"];// <---- this not work $_GET["var"];// <---- THIS WORK$_GET['var'];// <---- THIS WORK$_GET[var];// <---- this not work$_get["var"];// <---- this not work Edited October 21, 2012 by kanchatchai Link to comment Share on other sites More sharing options...
gongpex Posted October 24, 2012 Author Share Posted October 24, 2012 Hi, I rather don't understand with this taq : foreach($_SESSION['product'] as $key=>$value) especially at : $key=>$value can you explain to me? Thanks Link to comment Share on other sites More sharing options...
Ingolme Posted October 24, 2012 Share Posted October 24, 2012 That's the foreach() loop. Link to comment Share on other sites More sharing options...
gongpex Posted October 24, 2012 Author Share Posted October 24, 2012 (edited) I don't understand with page using like this index.php?shopping=ok on address bar, I had try to create page like this : index.php then shopping.php and on <form> on actiion I wrote like this : index.php?shopping=ok but it won't show anything, Q : what my mistake?_______________________________________________________________________________ OFF : I had read the topic ZendCon on general, what the mean of this? Edited October 24, 2012 by gong Link to comment Share on other sites More sharing options...
kanchatchai Posted October 24, 2012 Share Posted October 24, 2012 that's GET Action from URLhttp://www.w3schools.com/php/php_get.asp Link to comment Share on other sites More sharing options...
gongpex Posted October 24, 2012 Author Share Posted October 24, 2012 Hi, This tutorial is new? Because I didn't found it before thanks for reply_______________________________________- off : where do you come from? Link to comment Share on other sites More sharing options...
kanchatchai Posted October 24, 2012 Share Posted October 24, 2012 (edited) action POST safe and securitybut GET from URL powerfull for one script file if your need more action-----------------------------------------------------------------------------------------------I'm from Thailand Ser. Edited October 24, 2012 by kanchatchai Link to comment Share on other sites More sharing options...
gongpex Posted October 27, 2012 Author Share Posted October 27, 2012 (edited) Hi everyone, I think there is misunderstand here, please come to this site : http://demo.shop-scr.../free/index.php When I click one of the link (exmp : Price list) it's result : http://demo.shop-scr...?show_price=yes on address bar. When I debug on firefox it's using : <a class="menu" href="index.php?show_price=yes">Price list</a> Q : how to make file so that it can be shown like page on above using <a href> taq? please answer Thanks___________________________________________________________________________________ S : piyombombombe aling alang aling alang Edited October 27, 2012 by gong Link to comment Share on other sites More sharing options...
kanchatchai Posted October 28, 2012 Share Posted October 28, 2012 may move *show cart* section into function and... function showcart(){echo "<H1>my cart<H1>";//Move show cart section to here}if (isset($_GET["show_price"])&&$_GET["show_price"]=="yes"){showcart();} Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now