
garyed
Members-
Posts
198 -
Joined
-
Last visited
Everything posted by garyed
-
This seems like a hard way to do it but it looks like it works OK. Any suggestions ? value="<?php if(isset($_POST['owner'])) {echo get_value('owner'); } else { if(isset($_SESSION['owner'])){ echo $_SESSION['owner'];} } ?> "
-
Thanks for the ideas, I can get rid of the errors by initiating $_POST['submitter'] & testing if $_POST['owner'] is initiated but then my session variable gets lost when leaving the page. Keeping the session variable is where my problem is. if(!isset($_POST['submitter'])) {$_POST['submitter']="hello"; } // insert before using $_POST['submitter'] // change value of input to this: value="<?php if(isset($_POST['owner'])) {echo get_value('owner'); }?> " The session variable is really not lost but it doesn't appear in the input field after leaving the page & coming back to it which is the problem especially if I'm dealing with a lot of inputs.
-
Follow up with code: I didn't know if i should post this as a separate thread or not since the question is about fixing errors instead of covering them up. I'm trying to figure out how to get rid of the errors in this code because it's very similar to my site with a lot more inputs & I'm stumped. <!DOCTYPE html> <html> <head> </head> <body> <?php error_reporting(E_ALL); ini_set('display_errors', '1'); session_start(); // Starts session & uses function to keep data */ function get_value($var) { // this will check your session if it's not empty and you send an empty post if ($_POST[$var]!="" || (!empty($_SESSION[$var]) && $_POST[$var] === '')) { $_SESSION[$var]=$_POST[$var]; } if (isset($_SESSION[$var])){ return $_SESSION[$var];}else{ return $_POST[$var];} } ?> <form name="test" action="" method="post"> <input type="text" style="width:255px;" name="owner" value="<?php echo get_value('owner'); ?> "> <br> <input type="submit" value="submit"> <input name="submitter" type="submit" value="clear session"><br> </form> <?php if ($_POST['submitter']=="clear session") { session_destroy(); } print_r($_SESSION); ?> </body> </html>
-
Thanks for the encouragement, I know I'll get it done but it's just going to take time. I just do this as a hobby & the code on the site in question I wrote about 10 years ago. When you don't do it everyday, it's easy to forget how you did something that far back. I was just hoping I could fool php8.0 like i did 7.2 for a little while longer
-
I understand what you're saying & I definitely want to straighten the code out & get rid of all the errors properly. I had the same problem about a year ago,when my webhost upgraded the php version to 7.4. I turned off the errors to keep the site up & running & started trying to fix things but I just gave up after a couple days. I got lazy since everything was still working & just forgot about doing anything about the errors. I should have fixed things while I had the time but now I'm paying the price for procrastinating.
-
upgraded php version will not run phpmyadmin
garyed replied to garyed's topic in PHP Installation and Configuration
Not that I know of but that doesn't mean they are not there. I wouldn't even know where to look for them. -
Yes, since my site works under php 7.4 by turning off errors, is there a stronger way to turn off errors that might allow it to still work under php 8.0?
-
I've got about a thousand of them : Then it gets even worse because all of those errors can go away by turning off errors but then when you go further into the site it will lock up completely & go blank. If I keep the errors turned on then I can't get to the part of the site where it locks up to see what error is causing the lockup. It's actually a very involved load calculation sight with a lot of inputs & a lot of people use it & I want to keep it going.
-
upgraded php version will not run phpmyadmin
garyed replied to garyed's topic in PHP Installation and Configuration
I have tried investigating but have come up dry. Error 500 is pretty generic & doesn't give any specific details & I don't know where to start looking. Even if it's a permission issue I still don't know what to do to fix it. I've tried a couple edits on config files the other day but they didn't work & I can't even remember what I tried now. My next step was to copy all the phpmyadmin config files while I have 7.2 running & then compare them with the config files with 8.1 running. That's probably a waste of time but I figured before I do that I would post here & see if anyone was familiar with the problem. -
I have two versions of php (7.2 & 8.1) installed along with Apache server on Ubuntu 18.04 that I can switch back & forth from. If I enable 7.2, Phpmyadmin works fine but if I enable 8.1 & try to open Phpmyadmin, then I get the " HTTP ERROR 500" along with "localhost is currently unable to handle this request" message. Any ideas?
-
My webhost has upgraded from php 7.4 to 8.0 & I have quite a few pages on different sites that just will not work with the upgrade. I've been masking all my errors in 7.4 by using "display_errors = Off " in my php.ini & that's done the job until now but the pages will not work in 8.0 I guess all the bad code is catching up to me but we're talking about thousands of lines of code that I wrote years ago & it's going to take a long time to correct. I don't want my sites to be down so I'm paying a monthly fee to my webhost (1and1) to keep supporting php7.4 & I don't know how long that will last. I've also tried putting this in my pages to no avail: error_reporting(E_ALL ^ E_NOTICE); I'm just trying to buy time until I can get things right so I'm wondering if anyone has any ideas for me in the mean time. I do test all my new code for errors as I'm going along but all my old code was never tested for errors. This reminds me of what I was told about people who use computers a while back. There are two types, those who backup & those who will backup
-
Thank you for the explanation
-
If I use either of these statements, the result is the same. Joe has ([\d.]+) large apples Joe has (\d.+) large apples It doesn't seem to matter whether I put the square brackets in or not. Are those brackets are there for a reason beyond the scope of the usage in this particular statement?
-
I have been learning & experimenting with regular expressions as you suggested & was just curious as to why you use the square brackets inside the curly brackets. I've found that whether I use the square brackets or not, the result is the same. Is it optional or is there a specific reason why they should be used?
-
I see what you're saying now.
-
My bad, I was trying to make my example simple to get across what I was trying to do & never even considered that the answer could be different if there were decimals involved. Hopefully I'll be a little more thorough next time, but I really appreciate the help from you guys here.
-
Thank you, That was what I needed & I definitely do need to spend a lot more time learning those expressions. I know it's wrong but I usually learn backwards & try to find a solution to a problem when i run into one instead of learning the basics first.
-
I appreciate your help but I don't think that solves the problem. I just need to find one specific unknown number in a specific string out of a huge string with multiple numbers. The example of "Joe has (x) large apples" would be the line I'm searching for in like 1,000 lines of code with multiple numbers where (x) is an unknown number. Mac_gyver's solution worked because it took the specific string where the unknown number was inside it & pulled it out. The only problem is that it would only pull out a whole number & the decimal part was lost. Your solution would come up with too many numbers that I would still have to find a way to narrow it down to the specific string that holds the correct number.
-
Your solution would work if I knew the number in the string but the problem is that don't know the number that will be in the the string that I'm searching for. Basically I'm searching for the number inside a specific string that is inside a larger string.
-
Well I thought everything was solved but i found that (\d+) only works on whole numbers. I didn't think it would matter if the number had a few decimal points but I was obviously wrong. If there is a decimal like 5.5 or 5.25 then it will only pick up the 5 & not the rest of the number.
-
Thank you, that's what I was missing.
-
I've tried preg_match, preg_match_all & preg_quote but I can't find the syntax where I can find an unknown value in the string. All the examples I've found assume there are no unknowns in the string. In my string "Joe has 5 large apples", the number 5 is unknown during the programming call & I only know the string is "Joe has * large apples" .
-
I want to search for a string like: "Joe has 5 large apples" but don't know the actual number. In other words I want to search for the whatever number is in between "Joe has" & "large apples" I assume there is a way to do that in php but I haven't been able to find it. If so can someone help me with the solution ?
-
Thanks, I've been reading up on the Apache site but I still haven't figured out how to enable mod_ssl. It explains a lot about it but I don't see the actual steps to add it to the config file.
-
I'm using Apache on my home server & I ran the same code on my webhost server which I assume is Apache also. My phpinfo() shows Apache under server software environment on my webhost. Neither nginx or FPM show up anywhere in my phpinfo() on either servers. mod_php7 shows on my home server but not on my webhost's server. Home server running php 7.2.34, Web server running php 7.4.30