have a typical website that passed id values in the URL. ex. account.php?id=755 in the account.php page I do check the value But, I am trying to find away to encrypt the value 755 prior displaying it and then decode it prior checking the value. So I am not displaying the the actual id but a mask. My question …
Tag: php
How to create a logfile in php
I want to create a logfile for my system to register/log every action they do inside the system. But I have no idea how to do it. For example, I have this php code that does the login function. now I want to create a logfile entitled ‘the date today’, then when that functions is used for loging in…
How to access php session in javascript file?
Below is my code: index.php file javascript of index.php file HTML of index.php Description: I have a web page with url localhost/index.php. In index.php, I have a submit button on the click of which I call Result javascript method which sets the marks = 55 and put it into the hidden field and takes me to the…
Output PHP Code in HTML, literally
My question is very simple. All I want to do is write actual PHP code in HTML, without executing it. For example, I want to write I DO NOT want to execute this PHP. I want to literally write the PHP code on the html document, by somehow escaping the <?php tags (I don’t want to remove them). Unfortuna…
How to access content from multiple files
Is there any way that I can add the content of multiple files then put the combined values into one file? I am currently trying this: Answer include is for code, not for content. In your case you have to use file_get_contents so you can save the returned value. include will not give you that value. include() …
Making first letter capital using regex like in ucwords
I need to convert a String value in to Upper case (First letter to upper in every word). This can be done in php by using ucwords() method. Ex : Thanks with hi5 Answer Undermentioned will work great in all your situation How to use :: Try defining this code n your super class ( Best code practice ) Now
Make var_dump look pretty
I have a simple $_GET[] query var set for showing testing data when pulling down queries from the DB.
PHP DateTime round up to nearest 10 minutes
I’m retrieving a datetime from a mysql field but I need to round it up to the nearest 10 minutes. For example, If the datetime is 2013-11-06 14:00:01, I’d like to return the time as 6/11/2013 14:10. What’s the easiest way to do this? Any advice appreciated. Thanks. Answer 1) Set number of se…
Json_encode or remove last comma?
I figured out how to get my desired result (almost). My code adds a comma at the end before the last ] so it wont quite work. I know I can use Json_encode to build my array from my external json but I’m stumped. I either need to remove the last comma or use json_encode (which i’m lost on) any
Getting radio selection in PHP returns on not the value
I am trying to get the value of the selected radio button using php. But when I try to echo the value of the radio it returns ‘on’, no matter which radio button is selected when I submit the form. HTML: Then on the process page: Like I said, this just outputs “on” to the page. Help app…