-
Posts
6,906 -
Joined
-
Last visited
-
Days Won
99
Everything posted by ginerjm
-
Concatenate a variable and a string into another variable
ginerjm replied to ziggelflex's topic in PHP Coding Help
You were close. $structure = $root . "/dir2/dir3/dir4/dir5/dir6"; This line will take the contents of $root and append the string following the connecting dot. Not sure why your starting value of $structure has a leading dot in it but you probably know. -
What is a "varnish"?
-
You have issues with running the forum or with coding in PHP? Different forums for different questions.
-
So - this is your own server and you have a staff that built it and manages the PHP install. And it is your very first script/form using POST (odd). I think your IT staff needs to get an expert on PHP installations to tell them what they need to do. They should get on this forum with a new topic looking for help with this issue from their perspective. You are just spinning your wheels until they fix this. Good luck.
-
That's what I didn't want to hear. Thought it might be your problem. Do you not have any other scripts that you can use to try a post op? Any other apps or forms that do a post? Or is this your very first one on this server/provider? Do you run your own server or do you pay for one? If you purchase it can you/have you asked them why a Post doesn't work?
-
Let's try something. I am by no means a PHP expert nor do I know anything about installations of it but I see this setting in my phpinfo and I wonder what you have there. In the test.php script add this line: print_r(phpinfo()); Then look at the output in the CORE section. Tell me what the setting is for "enable_post_data_reading".
-
And also - when you post code here it is highly recommended that you copy and paste (we know that you know how that's done) it here instead of putting up pictures of it. That way we can more easily view it and if we want to, we can copy it and edit it and place it back if it needs to be done.
-
What you are being told is that the character set being used by the stuff you copied off the internet is wrong. Use that example as a source but TYPE IT IN YOURSELF so that the character set is what you are using.
-
Hello? Are you still interested in resolving this or should I go do something else?
-
Add a name= attribute to your submit button. Let's see what $_POST shows then. Currently the print_r($_POST) is showing you nothing and that can't be. So perhaps you have 2 test.php scripts and you are running the wrong one. Put something into the one you think is being run and let's see if it shows up on your screen.
-
That is ALL OF THE CODE??? Try to run this code as 'test.php'. <?php ini_set('display_errors', 1); error_reporting(E_ALL); echo "now running test.php script<br>"; if(isset($_POST['ceva'])) { echo "Ceva is: ".$_POST['ceva']; } else echo "Ceva is not set<br>";
-
I think there is something we are not being shown that is causing the problem. That's why I would like to see all of the code in each file
-
Then show us both of those completely
-
Is all of the displayed code in a SINGLE script? If so, can you show us THAT script?
-
Since one fix has nothing to do with another one I"m not sure what your problem is. You are simply trying to change string x to string y. Where's the confusion? And as pointed out already if these are all HTML tags then you don't need the /> close nor the </ you are using as an opening tag perhaps.
-
$result = str_replace(['abc','def','xyz'], ['ABC', 'DEF', 'XYZ'], $string); The above will change "abc, def, xyz" to: "ABC, DEF, XYZ"; My $.02. Str_replace will do an exact replacement of literal strings of characters. This is regardless of whether they are 'tags' or not.
-
Undefined variable error but that variable has been declared
ginerjm replied to webdeveloper123's topic in PHP Coding Help
My code is backwards I should have used !empty. AS for you code; once again you posted dozens of blank lines that make it tedious to wade thru. And you are still doing multiple things that don't go together. I wish you luck. Signing off this topic. -
Object of class mysqli_result could not be converted to string
ginerjm replied to yami's topic in PHP Coding Help
Could we see the code you are now using as well as the exact error message? And be sure to point us to the line number -
Object of class mysqli_result could not be converted to string
ginerjm replied to yami's topic in PHP Coding Help
Are you sure about the line? I don't see any attempt to convert a var unless it is the two Values in your query statement. Try separating the query build from the query call and see what happens. $q =...... mysqli__query($connection, $q); -
Undefined variable error but that variable has been declared
ginerjm replied to webdeveloper123's topic in PHP Coding Help
I did some cleanup and added a lot of comments. Please read thru it slowly and listen to what I am saying. This may not be the best method but I hope I am conveying some of the logic that you need to be thinking about. //************************************* $errmsg = ''; // stop using mixed cases. this is not javascript $formid = isset($_GET['user_id']) ? $_GET['user_id'] : ""; if ($formid == '') $errmsg = "Missing user id<br>"; // why are you doing this here? $queryselect = "SELECT FormId, FirstName, LastName, Email, Age, Birthdate, FavLanguage FROM Form WHERE FormId = '$formid'"; // Don't run the query if you have no user id $result = mysqli_query($link, $queryselect); if (!$result) { // you should have already checked the connection before you get to this point echo "Error in QUERY: <br>", mysqli_error($link); exit(); } // You are retrieving the results of a query but then you are handling the results of the user's input // Does not make sense $row = mysqli_fetch_assoc($result); // you should not be here if you haven't verified that the user has subtmitted the form $fname = (empty($_POST['fname'])) ? $_POST['fname'] : ''; $lname = (empty($_POST['lname'])) ? $_POST['lname'] : ''; $email = (empty($_POST['email'])) ? $_POST['email'] : ''; $age = (empty($_POST['age'])) ? $_POST['age'] : ''; $birthday = (empty($_POST['birthday'])) ? $_POST['birthday'] : ''; $fav_language = (empty($_POST['fav_language'])) ? $_POST['fav_language'] : ''; // Add some lines of php code to validate your inputs. Add to the errmsg if necessary using '.=' operator // // if everything is valid now do the update if (!empty($errmsg)) { echo $errmsg; exit(); } $updatequery = "UPDATE Form SET FirstName = '$fname', LastName = '$lname', email = '$email1', age = '$age1', Birthdate= '$birthday1', FavLanguage = '$fav_language1' WHERE FormId = '$formid'"; echo "update query is: $updatequery </br>"; if ($result1 = mysqli_query($link, $updatequery)) echo "Update query has been run"; else echo "Update query failed to run"; // Now what? Hopefully my comments will help you to see what we are seeing and wondering about. BTW where do you actually send the input form to the user so that they can submit it to this? In another script? And why not use a input value for the user id that you want? -
Undefined variable error but that variable has been declared
ginerjm replied to webdeveloper123's topic in PHP Coding Help
Since the 'submit' element is simply a button, looking for empty is not what you want to do. The suggestion to check the requestmethod is the thing to do. After that (if present) you do the empty check on the REAL input values. Better yet check if the item has the proper value according to your app's needs. If any of the inputs are not valid, output an error message along with the form back. Only if everything is present and valid do you move onto the query process and update. BTW since you obviously read the part about using a check for request method, how come you haven't put it into your php code yet? You are wasting your time and ours -
Undefined variable error but that variable has been declared
ginerjm replied to webdeveloper123's topic in PHP Coding Help
Well, read up on the best way to validate the input items. Then add some code to send a message to the user when he doesn't provide an id. And stop putting all those blank lines in your code. And learn how to read and take to heart what you are being told. You have posted the same bad code 3 times here. -
Undefined variable error but that variable has been declared
ginerjm replied to webdeveloper123's topic in PHP Coding Help
You haven't done anything to fix the problems. Despite my suggestions on isset not being the right tool. Q If you don't have a get parm for the id, WHY do you continue on with your script? -
Undefined variable error but that variable has been declared
ginerjm replied to webdeveloper123's topic in PHP Coding Help
SHOW US YOUR CODE PPPPLEASE -
Undefined variable error but that variable has been declared
ginerjm replied to webdeveloper123's topic in PHP Coding Help
This post was not at all helpful for us to help you. You are showing us the same old code here. Why? Did you not make any improvements? Also - show how us the echo of the query. And stop relying on isset to validate your input. Did you not read my previous post about how all form elements are always set in the POST array (except checkboxes) so therefore you have to do more than apply the isset function to ensure you actually have some data?