Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. Your code is not what you think it is. Your name attribute is the string "answer" followed immediately by the value of your QID column from your query. So if QID for that row is "123" then your name is "answer123". So to extract it form the post array you would have to use "$_POST['answer123']. But all of this is meaningless since the whole point of radio buttons is to provide a set of choices from which the user may only choose ONE option. This will not produce an array in $_POST, but merely a single value so your very complicated code to manage the returned value from the user is unnecessary.
  2. So - just do it? What is your problem with doing this, albeit it doesn't make sense to me.
  3. When you have assured yourself that you are using the proper syntax then the problem must lie with your data. If you had validated your input before trying to use it you would have caught this error. There is NO element $_POST['anwer']. You do have an element in the POST array named "answer?" where ? is the value of your QID column.
  4. BTW - why do you have an onclick to direct you to the result.php script as well as a form directing the submission to the same script? The onclick is not needed, and depending on whether it happens before the actual form submission, it may cause you problems in result.php.
  5. That means read the manual and understand what that function requires.
  6. And the error was?
  7. 1 - It would be nice if you had read the rules and learned how to post your code here properly 2 - It would be nicer if you commented your code so we could follow your thought process 3 - It would be even nicer still if you could indent your code to make it easier to follow and read. 4 - read up on sql syntax. String values have to be in quotes since you are not using prepared queries 5 - while reading manuals, read the php one re: the MySQL_* functions. They are deprecated, ie, don't use them. This code is really bizarre: if(!(($_SESSION['AssessuerSess']=="done"))) { Try this instead - much easier to write and understand. No inverse logic and only one set of parens, not 3. if ($_SESSION['AssessuerSess'] != "done") {
  8. Your function has some faults with it. 1 - If you are always going to feed an array of 4 values to the function then you should check for that in the function by using count() before attempting to process the input data. 2 - If you are NOT always going to have 4 values, then you need to change your function code to handle a variable number fo inputs (in the array). The foreach() would be ideal for this purpose. 3 - personally I would never use a default value in my function header of simply "array()". Setting the parm to a simple 'null' is sufficient for the ensuing code to check before continuing to process.
  9. Methinks you are searching too deep. Your third level index - what is the value you have set in $boxes? That is the only element you will do your array search on and that is too low.
  10. You have data that you want stored. Apparently you have a key that then has defined, ie, named values related to it. Why are you not using a db table? BTW - "...need advice storing variables..." - your title. Your data is not variables - it is data. What you are asking is how to store it. I suggest definitely not placing it in any variable until you first store it. And storing data is the preserve of databases. You state that each object can have an unlimited number of extra fields. Looking at: 3434432545 -> 32435219098999, title description 21 I'm assuming that 3434432545 is your 'object' and that the part following -> are two of the extra fields that are connected to that object. My question is - do you mean to say that the above object will have another pair of values like the ones above (but not the same value), or are you saying the data attached to this object is different, as in representing other info about this object? If the former, then you table structure could simply be "object_num,id_num,title" to represent the above, or it could be "object_num,id_num,title,someotherfield,somethirdfield,etc.,etc.,etc." as an object with several different attributes linked to it. AND - should you need multiple sets of these attributes, you simply create successive records using the same structure, with perhaps some counter, or sequence number to help uniquely identify each set of data belonging to a specific object number. I hope I have made myself clear with my impression of your scenario and that you can adapt this to your personal vision.
  11. Perhaps you should read up on the usage of various HTML elements. The entire purpose of radio elements is to present to the user a specific choice of answers to a specific question, which apparently does not fit your needs at this time.
  12. YOu are checking if a field in your result row exists when you know it will be there. Simply echo the row fields. If it's blank you'll output that field in its proper place without shifting other ones in its place.
  13. Works for me. Although you might want to change & to just
  14. Why are you exiting php mode in your foreach?? <?php $test = array('blue','green','white'); foreach($test as $val) echo "$val<br>"; exit();
  15. I see we overlapped in our responses... So you have two inputs - votes and values. What exactly are these? Strings with the pipe symbol separating the individual values? But you want to move them out of strings and into an array? Your example is confusing since the inputs look like the same thing as the desired output, and they both look like strings. If you inputs are string then do this: $votes_ar = explode('|',$vote_results); $values_ar = explode('|',$value_results); Now you will have two arrays containing your two results. Although, if you are building those input strings yourself, why are you making strings to begin with?
  16. Your code looks strange to me. What is that first line supposed to represent? I don't know what that syntax is. Secondly - why do you want to load your $check array with values followed by the pipe (|) symbol? What purpose does that serve you - combining data with an arbitrary character? Plus you have alternating values in your array - a vote, then a value, a vote, then a value. Pictorially you will have this: $check[0] 'vote1|' $check[1] 'value1|' $check[2] 'vote2|' $check[3] 'value2|' $check[4] 'vote3|' and so on. How will this be useful to you?
  17. One would think from the previous difficulty that you would have done some research on your own and RTFM for that function as well.
  18. Now that you know that function has been DEPRECATED (as in gone, not 'reduced in value'), the answer to your question is simply to use if (isset($_SESSION['isAuthenticated']) && ($_SESSION ['isAuthenticated'] = "loggedIn")) NOTE - I left the error in your code in my sample. You have only one = sign in your compare - you need two.
  19. Is you mail client ready to receive html mail? It's an option often.
  20. I have no idea what you are showing us.
  21. As Ansego said - show us how you send the mail. Very important piece you forgot to show us.
  22. Its' probably a function of your browser's handling of textareas. Try using your css to specify the same font for textarea tags as you are using in the rest of your page.
  23. Why so many php tags in your code?
  24. Or simply don't use the strtotime function call. Date() is providing you what you want but then you go and turn it back into an integer. BTW - the result of date() is not an integer.
  25. You need to show more code. Your question mentions MySQL info which we have no idea about; your html snippet is rather incomplete so as to make it hard to fully interpret for correctness; and your mention of a submit button doesn't show us any code that defines it nor processes it. Besides that if there truly is no submit button clicked then hih do you even get to your php script???
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.