-
Posts
6,906 -
Joined
-
Last visited
-
Days Won
99
Everything posted by ginerjm
-
How is this a PHP question?
-
So that would be triggered by the exit() that usually follows one of these? So getting back to the OP's question. Since his SERVER outputs are all commented out in his post, what are we supposed to be diagnosing for him? Oh - Silly Me! If he had php error checking turned on, would he be seeing that "headers already sent" message and his echos would be failing because of that header?
-
So in this case, if it doesn't take you to another 'place', what IS it doing?
-
I should have specified "using the Location" instruction, as the OP was doing
-
Once you issue the header command the script doesn't execute anymore.
-
I use something called HTML-Kit Tools. Great editor - colorizes different things so that you can easily recognize a typo/mistake. Connects to your server to do uploads easily, has browser preview windows as well. Very inexpensive. Has a trial version too I think. Google it.
-
newbee to PHP, help with setting up my php to send to a txt file
ginerjm replied to CarriesBack's topic in PHP Coding Help
Do you have access to the online PHP Manual? That would be a good place to lookup how to use these functions instead of just throwing code together that can't possibly function properly. The is_numeric function as the manual would say gives you a true/false response when you test a single value. You can't combine that with anything else, which is what you are writing. The manual would show you (I think) examples of how to use that function and many other functions. The link: http://www.php.net/manual/en/funcref.php -
newbee to PHP, help with setting up my php to send to a txt file
ginerjm replied to CarriesBack's topic in PHP Coding Help
Your line: if ((is_numeric($BowlerAverage >= 0)) && //the user can fix them. This makes sure ($BowlerAverage <= 300)) { //the average is within the parameters of is difficult to follow. Are you testing if the result of a comparison is numeric? What would make sense would be: if (!is_numeric($BowlerAverage) || $BowlerAverage <= 0 || $BowlerAverage > 300) { (show as error) } Note how my code samples here are formatted. When posting code here you should wrap it in "php" and "/php" each in square brackets. Also - just my opinion - but using mixed case in php can become a real PIA since php is case-sensitive. Get used to using all lowercase so that you don't end up having to trade thru your scripts looking a bug caused by the mis-typing of a name somewhere. What is the "n" for at the end of savestring? -
newbee to PHP, help with setting up my php to send to a txt file
ginerjm replied to CarriesBack's topic in PHP Coding Help
We aren't averse to helping you out. You just need to read what has been said and start making the changes recommended by us and re-post your 'improved' code. Be sure to read them and follow them because people here don't like to make recommendations and have them totally ignored by someone who can't bother to read and absorb what is being said. Can you show us your current (modified?) code yet? -
newbee to PHP, help with setting up my php to send to a txt file
ginerjm replied to CarriesBack's topic in PHP Coding Help
If the code you posted is a result of what you are being educated on, you are being seriously taken advantage of. You don't even know how to turn on php mode properly yet. What kind of teaching is that? You blame the professor, I blame the choice of school if that is what they are giving you. If you didn't get it - my response to you should have made you realize how far you are from being any kind of php coder. Don't shoot me because your learning is taking you down the wrong path. Good luck. I do hope you can make significant gains with mac_gyver's extremely detailed writeup. A lot there to digest. -
newbee to PHP, help with setting up my php to send to a txt file
ginerjm replied to CarriesBack's topic in PHP Coding Help
Where did you copy this from? Are you taking credit for this abomination? You begin with html code. Bad move for a PHP script. One should start with the php and finish with the html You start your php code (finally) by asking if the Submit button has been set or not. If not - YOU START LOOKING FOR POST element inputs!!! WHAT?! That's where I stopped. 1 - learn what it means to ask the question about whether there is a post present. 2 - learn to check what you have written before asking for help. 3 - If you supposed professor is not being helpful, time to read the textbook and get a manual too! And if you're one of those newbies who say they don't learn well from reading, then I.T. is not in your career path. -
You are using php in your table elements currently. Not the greatest way but you are. Try writing your code and reading it. YOu are outputting the table column headers twice here. You are moving in and out of php mode without using the proper tags. Get yourself some php reference material (the online php manual is excellent if you haven't discovered it yet) and read up on what a php tag looks like. Ex. //(in php mode already) echo "<tr>"; echo "<td>$t</td>"; echo "<td>$p</td>"; echo "<td>$hum</td>"; echo "</tr>"; This is the easy way but there are other ways too. Thought this would be clearer for your untrained eyes.
-
Early booking reservation system using DateTime
ginerjm replied to bg17aw's topic in PHP Coding Help
There are never two possible answers if you keep your thinking straight. A date string with - in it will translate as dd-mm-yyyy or (if written better) yyyy-mm-dd. Decide which you are using and then stay that way. AS has been pointed out you are storing date values as strings and not datetime objects which is confusing to us as well as to you apparently. There would be no confusion if the array used dt objs instead of strings. -
Have you attempted to do any reading/learning of php so that you might glean some knowledge of your own? This is how it s/b written. $select_var = "<select name='size' id='size'>"; while ($lrow = mssqlfetchassoc($tres)) { if ($row['tsdescription'] == $info['size']) $selected = 'selected'; else $selected = ''; $select_var .= "<option value='" . $lrow['ts_id'] . "' $selected>" . $row['description'] ."</option>"; } $select_var .= "</select>"; Always try and stay in php mode until you finally output your entire html doc. Here you build the necessary dropdown into a var. Down lower in your script where you assemble the bulk of you static and dynamic html, insert this var where it needs to be and your page will display it properly. Don't keep spitting out pieces of html and then doing some php and then spit out some html. It's confusing and hard to follow and even harder to maintain later on.
-
If you turn on php error checking you should be seeing the error on your first query. YOu have an extra comma in there. See my signature.
-
Does your script show you any errors? YOu have a mistake in your query so I'm thinking that you should be getting some error message but perhaps you don't have error checking turned on to see them. What tells you that the info is not being posted? The mere lack of it? Does your script give the error you setup for the query failure? Give us a hint as to what is NOT happening in your script. If you don't know, add some echo lines to show the progress of your script so you can pinpoint the spot where it goes south. PS - you really need to learn how to sanitized your inputs so avoid problems when plugging them into queries. Look up the use of prepared queries asap. Also - you should learn how to intermingle " and ' chars to help you avoid having to break up your strings like you are doing. An ex.: "INSERT INTO candidate (surname,forenames,dob,gender_id,domination,nationality_id,address,country_id,accommodation_id,session,connection_id,) VALUES ('".$surname."','".$forenames."','".$dob."','".$gender."','".$domination."','".$nationality."','".$address."','".$country."','".$accommodation."','".$session."','".$connection."')" && " INSERT INTO `guardian` (parent_name,profession,phone,email) VALUES ('".$parent_name."','".$profession."','".$phone."','".$email."') "; could be written as: $query5 = "INSERT INTO candidate ( surname, forenames, dob, gender_id, domination, nationality_id, address, country_id, accommodation_id, session, connection_id,) VALUES ( '$surname', '$forenames', '$dob', '$gender', '$domination', '$nationality', '$address', '$country', '$accommodation', '$session', '$connection' )" && " INSERT INTO `guardian` ( parent_name, profession, phone, email ) VALUES ( '$parent_name', '$profession', '$phone', '$email' )"; Of course this is still a poorly written query statement since it is subject to injection but I am showing you how you can save a lot of frustration in writing complex string.
-
Help with the 'checkbox' to agree to terms prior to upload
ginerjm replied to Chrisj's topic in PHP Coding Help
What a mess of code! Didn't even try to figure out what you are attempting to do here but did search for how you handled the checkbox. You have a JS function that is trying to check the checkbox being checked. You have no php code trying to do that. Personally that would be the first thing I would do in the script - look for the checkbox being set (!!!) since if it is not checked it won't show up in your $_POST array. Currently you do all the file upload logic without checking if your "requirements" have been met. That is backwards. So - the real problem. Where do you call the 'validate()' function? I couldn't find the word 'validate' in your entire script(s) so that means it is not being used. -
You didnt' offend anyone. You just did not explain yourself very well nor did your reply to my post make any sense at all. As Jacques says - please TELL us what you are doing and want to do and leave out the "technical" stuff.
-
Alright - I'll bite. Pardon me if I am showing my ignorance here but just what is that text that you posted? Is it some form of sql that I have not seen. I don't venture out of my 'space' much (cause I don't have to) so it may be some variant used by whatever your current database is, but I have to ask in order to find out. If it was meant to be a pseudo-code to help us understand what you wanted to do, all I can offer is this: Read the chapter that Barand pointed you to. It will not only explain things but will give you many examples of how to create a query statement (using substitute parms for a "prepare query") as well as doing a prepare call and finally binding your data to the substitute parms. Then you do the execute and process the results much like you probably have done many times before. PS - imho go for the :parm syntax for your substitute parms. Then you simply build an array of parms and values without having to worry about setting up "bound parameters" types. $q = "select fielda, fieldb, fieldc from mytablename where id = :idval"; $qst = $pdo->prepare($q); $parms = array( ':idval'=>$id_from_user ); if (!$qst->execute($parms)) .... handle error else ... continue processing results where $pdo is the handle you get after establishing your db connection.
-
I have no idea what you just posted. And you email client doesn't matter here.
-
I assume it was that line of html, since you didn't tell use who have been trying to help you.
-
mysqli_fetch_array line blocking every code below it
ginerjm replied to ersaurabh101's topic in PHP Coding Help
How to turn on error reporting? You could reference the manual which is great for learning about stuff. Or you could look at my signature. -
You need to write a script that presents an input form to the user where he will type in his address. The form's submit button should take you to the emailing script where it will retrieve the $_POST values from the form that you want the user to provide. If the values are correct then you build the email body and the subject and the headers (very important!) and call the mail function. Try reading the php manual for mail() if you must use that. There are better mail packages out there but you seem to be at a very early stage of development. Of course if you have already done this then it would have been nice if you posted that (in the proper forum tags) so we could further help you. PS - I have no idea what that anchor tag is for.
-
You see that input tag line EXACTLY as you typed it here with the little boxes and the unnecessary quotes at the end? Have you tried re-typing that line into your script? Delete the entire line and start it over? Did you copy this code from somewhere that introduced a character set you are not expecting?
-
So what did your debug statement show you?