cabbie Posted May 3, 2023 Share Posted May 3, 2023 (edited) How do I save or what is the syntax to save a button in a cookie? test site test I did try a header like <h3>Hello</h3> but get error with a boot5 button. <code> <?php $mp = "vids/coli.mp4"; $dall ="aaa";// echo "dall=".$dall; $uep = `<button type="button" class="btn btn-warning" onmouseover="show(0)" onmouseout="hide(0)" onclick="skip(-5000) ">0:0:0</button>`; //echo "uep=".$uep; setcookie('mp'.'$mp'.time()+30*24*60*60.); setcookie('dall'.'$dall'.time()+30*24*60*60.); setcookie('uep'.'$uep'.time()+30*24*60*60.); ?> </code> ? Edited May 4, 2023 by requinix removing unnecessary verticality Quote Link to comment https://forums.phpfreaks.com/topic/316251-buttons-and-cookies/ Share on other sites More sharing options...
cabbie Posted May 3, 2023 Author Share Posted May 3, 2023 This is a site I am working on After setting a EP I want to save the src for video the comments and buttons added I am beginning to think it is impossible web site Quote Link to comment https://forums.phpfreaks.com/topic/316251-buttons-and-cookies/#findComment-1608011 Share on other sites More sharing options...
requinix Posted May 4, 2023 Share Posted May 4, 2023 What do you mean, "save a button"? 1 Quote Link to comment https://forums.phpfreaks.com/topic/316251-buttons-and-cookies/#findComment-1608013 Share on other sites More sharing options...
cabbie Posted May 4, 2023 Author Share Posted May 4, 2023 (edited) It's a long story but if you go to this site in development, you will get a better idea what I am trying to do. It is a system to build like a 'TOC' or entry ponits on the video . The buttons when clicked goto whatever cuttennt-vid-time you have set. It is for video presentations and other things. Go into the video and click the new ep button, You will get a popup explaining the operation, When done I want to savethe src of the video, comments for the entry points and the buttons added in cookies Use the red EP button as return after playing the video a few seconds and adj to desired EP Video site The actual php (reached by ajax) to set cookies <code> <?php session_start(); if(isset($_POST["mp"])){ // echo "set"; $mp = $_POST["mp"]; $dall = $_POST["dall"];// echo "dall=".$dall; $uep = $_POST["uep"]; //echo "uep=".$uep; $_SESSION["mp"] = $mp; $_SESSION["dall"] = $dall; echo "sesdall".$_SESSION["dall"]; $_SESSION["uep"] = $uep; echo "sesuep".$_SESSION["uep"]; setcookie('mpCookie'.'$mp'.time()+30*24*60*60.); setcookie('dallCookie'.'$dall'.time()+30*24*60*60.); setcookie('uepCookie'.'$uep'.time()+30*24*60*60.); </code> } ?> Edited May 4, 2023 by cabbie Quote Link to comment https://forums.phpfreaks.com/topic/316251-buttons-and-cookies/#findComment-1608014 Share on other sites More sharing options...
requinix Posted May 4, 2023 Share Posted May 4, 2023 Still not following, and I can't go through your site at the moment, but: It typically doesn't make sense to put values into both the session and cookies. One of them is enough: put the values in the session if you want to remember it for the user account (kinda), or put the values in cookies if you want to remember it for the device they're browsing with. And if you choose to use cookies only, you don't even need AJAX - you can create cookies perfectly fine with Javascript. So, then, I guess, general troubleshooting: Can you see that the AJAX request is being POSTed correctly with the right data? Does your browser show the cookies updating values, or at the very least expiration times? Quote Link to comment https://forums.phpfreaks.com/topic/316251-buttons-and-cookies/#findComment-1608018 Share on other sites More sharing options...
ginerjm Posted May 15, 2023 Share Posted May 15, 2023 Yes. Is this still an open topic? Usually people let us know when they are done with it. Although I would love to know what you mean by 'saving' a button? A button is simply some code so how would one do that and then use a 'saved button'? Quote Link to comment https://forums.phpfreaks.com/topic/316251-buttons-and-cookies/#findComment-1608399 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.