Jump to content

phppup

Members
  • Posts

    683
  • Joined

  • Last visited

Everything posted by phppup

  1. I may be using the wrong terminology, but I want to get to the text that is visible next to the actual radio button that would be selected. I want the confirmation ALERT to confirm which radio was selected by repeating the same text that is on screen (regardless of the value). I've seen it accomplished. {I think I used .parentNode.textContent and got close, but it was not achieving the desired goal.)
  2. My research has proven that this is not as common as I thought, so I need some help, please. I have included code and do NOT want the VALUE of the readio displayed, but rather the inner HTML or textContent (as I have seen if referred as) <form name="form"> <b>What do you like best?</b><br> <input type="radio" name="group1" value="mommy" checked> i want to see this: mommy hands<br> <input type="radio" name="group1" value="toys"> i want to see this: toys and talking<br> <input type="radio" name="group1" value="monkeys"> i want to see this: monkeys and tigers<br> <input type="Button" onClick="whichButton()" value="What did you check?"> </form> <script language="JavaScript" type="text/javascript"> function whichButton() { var group1Checked for (var i=0; i<document.form.group1.length; i++) { if (document.form.group1[i].checked) { //group1Checked = document.form.group1[i].value; //This worked, but provides VALUE element NOT the TEXT that is desired group1Checked = document.form.group1[i].textContent(); } } if(group1Checked){ //if(group1Check) is just saying, "if group1Checked does not equal null" alert("I like " + group1Checked + " best.") } else{ alert("You did not make a selection.") } } </script> And, I am only interested in displaying the ONE single selected radio button that is checked. Thank you.
  3. I understand that a span is not a form element, but isn't the JS creating a variable that can be 're-shaped'?
  4. That was my initial intention (i like knowing I am on the right path, as I'm sure YOU do too, my friend) but after discovering that I can gain 'access' to the phrase in a <span> through JS, i became compelled with finding the method of 'transforming' and using IT as the value; thereby saving a few lines of code [at the expense of several hours of wrestling and research]. Aside from abandoning my quest, is there a way to convert this element so it can be interpreted as a value on the PHP side? PS: This is all occurring inside of a form.
  5. I have used the following JavaScript to create and HTML span of text and then populate the area: document.write("<span name='msg' id='msg'></span>"); document.getElementById("msg").textContent = "This is a test"; And when I add this code in JavaScript, I can see validation of the element's functionality. var A = document.getElementById("msg").textContent; document.write(A); Resulting in the phrase "This is a test" being displayed. However, I cannot get the phrase to connect into PHP. I've tried incorporating $msg=$_POST['msg']; and $A=$_POST['A']; echo "This is the message from ".$A; But there doesn't seem to be a connection occurring. How can I make the jump so that the PHP acknowledges the phrase inside the HTML span tag?
  6. I have several HTML files that I've developed and have realized the need to pass a common variable between them (although the variable originates with Page1 and is not really required until Page5, it seems the most effective method would be to shuffle the data through the chain of pages). Example: Page1.html - select the important category that you want to see information about Page2.html - what is your email address etc. (does not effect CATEGORY selection) Page3.html - some random information that does not effect CATEGORY selection Page4.html - click link that will use the VARIABLE from Page1.html to redirect to the webpage for the CATEGORY you selected. Is using SESSIONS throughout all the pages the most effective method to accomplish this? Can I simply add <? session_start(); with the essential variable ?> to the HTML page? Or does it need to become a PHP page? Is there advantage to either approach or a better alternative?
  7. Sorry, missed that lone word sitting there all by itself. So it's been a futile effort. Good to know LOL
  8. I understand that, but is it possible to include a HOVER characteristic (for a submit button to change color) with inline coding? Not sure if it's impossible, or if my syntax is incorrect.
  9. I've used inline styling periodically in my HTML for various items by adding style="color:red" and similar variations depending on my needs. Is it possible to do the same with HOVER to change a background-color, fon't-size, or style etc. when the cursor is hovered over the element? If so, what is the correct syntax to use? Note: I've seen solutions that use OnMouseOver/OnMouseOut, but am specifically interested in HOVER. Thanks.
  10. KUDOS to requinix. You were correct. After closer review I realized that I had used a JavaScripted datepicker in my form and it was causing the quirky error. After removing it, the error vanished. Replaced it with a simple HTML <input type='date'> and seems to be okay. GOOD CALL, thanks.
  11. That's the idea of what I want to do, but not quite as complicated. At least not yet. At this point I wanted the script to run through the table and send and email to those 30-day customers and a different email to the 10-day customers. My approach was to SELECT those that were at the 30-day mark and use a second SELECT to grab the 10-day folks. And yes, I was coordinating it so as not to 'step on my own feet' in the process. As two separate scripts, the goal is achieved. But when I tried to combine the two I ran into conflicts. I had thought I could somehow control them by referencing them as variable ten_day and thirty_day (or something in that vain) but it was not as simple as I had hoped.
  12. Nope, I don't create messages that say things like "undefined." My messages are more specific and fun (like echo "Time for lunch" which is always easy to find in a script).
  13. My problem is in establishing SQL1 and SQL2. I've seen different examples with conflicting information. Can I name them SQL1 and SQL2? Or return_1 and return_2? This effort seems to fail in all efforts. Using just SQL twice seems to only run the FIRST of the SQL statements. And, yes, my email is in two separate functions depending on whether the 30_day or 10_day is in effect per SQL statement. So, as it stands now, SQL statement equals 30_day function criteria, and all is well. If I were live I'd now have 18 days to work out the 10_day trigger (or simply duplicate the 30_day script with 10_day criteria which, at the very least, adds a duplicate file to my storage). How do I include the second SQL without effecting the first?
  14. I believe the quote marks are in the original scripting, just not included in the expedited question entry. Also, I will double check, but I do not recall placing any JavaScript in my coding (as PHP was giving me enough troubles on its own... LOL).
  15. I have a basic <form action=insert.php> I developed it and have it working well. It provides confirmation and error messages upon submission as designed. When I visited a friend to show him the form, we used his Internet Explorer (not sure of the version) browser rather than the FIrefox that I had been used to. Naturally, the look was slightly different, but upon submission, it went to the PHP page with a simple one word message of: undefined. We used his laptop which had Chrome and all was well. Is there a known issue or coding that I need to avoid such instances in real use situations?
  16. It's been a fun week of learning while battling coding problems. So now, I need advice for the challenge.. The objective: SELECT *FROM table WHERE moneyisdue != 0 AND x30daynotice = ' ' ; then, send email saying "PAY ME NOW" and UPDATE table SET x30daynotice = 'YES' WHERE moneyisdue != 0 AND x30daynotice = ' ' ; then SELECT *FROM table WHERE x30daynotice = 'YES ' AND x10daynotice = ' ' ; then, send email with LEGAL THREAT and UPDATE table SET x10daynotice = 'YES' WHERE moneyisdue != 0 AND x10daynotice = ' ' ; My initial desire was to create a single script and run it daily to remain current. Naturally, this is where I ran into trouble. I've devised a simple solution of running 2 separate files: one for 30 day and one for 10 day. But the question remains, from a PHP perspective, is a SINGLE file more efficient? And if so, can you provide an outline that I can use for guidance? Note: I am ONLY using "YES" in the table for testing purposes and immediacy. In actuality, a timestamp or date mechanism will be implemented. Right now I am just interested in having the 10 day notice follow the 30 day notice effectively.
  17. I do not presume this to be a coding issue, as I am using the same code throughout my efforts for firstname, lastname, phone, etc. All provide the info I request EXCEPT for email. Perhaps it is something with the required characteristic of the column in the table that I am not aware of. It'd be great to get pointed in the right direction.
  18. I have a VARCHAR column in a testing table. The column is titled 'email' and holds addresses. When I use PHP to echo firstname, lastname, and emails info, I get all other columns except for the email info. Any thoughts??
  19. I have a simple form that (for test purposes) has fields for first_name and last_name and then can submit. I want to validate whether a given name is in the table. //$query = "SELECT * FROM w WHERE id>='90' "; //$query = "SELECT * FROM w WHERE first_name='steve' "; $query = "SELECT * FROM w WHERE first_name='$first_name' "; $result = mysqli_query($link, $query); if (mysqli_num_rows($result) == 0) { echo "NO RECORDS<br />"; } if (mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { echo "ID is ".$row['id']. " now<br /><br />"; } } I have a simple form that (for test purposes) has fields for first_name and last_name and then can submit. I want to validate whether a given name is in the table. Weird scenario: When I $query by 'id' the four records in my table list. When I query DIRECTLY by first_name='steve' I get the correct ECHO for his ID# 93 But when I query with $query = "SELECT * FROM w WHERE first_name='$first_name' "; I get to one echo message for "ID is 21 now" and another for "ID is 77 now" [Oddly, 21 + 77 = 93, which is Steve's ID] Please help.
  20. Good to hear from you again, Barand. I'll give it a try and see if it suits my needs. THANKS.
  21. Another episode of brainstorming has left me with more questions than answers. Guidance, advice, and solutions would be welcome. I'll try to make it simple (as I haven't even gotten off the launchpad yet): table "info" holds id, fname, lname, email, phone, fav_song, fav_pet, fav_food. Initially, a user will fill out a form with only fname, lname, email as required. Hypothetical situation: user submitted form with required fields and listed LaLaLa as fav_song. Next day, user got a dog. My thought process: if email does not exist... insert as new user If email does exist UPDATE fav_pet as 'dog' only when ==null. As a side note, will identifying 'email' as a unique key help me? And if I do use it as a unique key, can I shut off or edit the SQL error message (so it is not visible to users in its complete statement)? I've played with UPDATE ON UNIQUE KEY but haven't been able to UPDATE two or more values (ie: if all favs were null) and am not certain it is the right direction to go.
  22. Stayed up late again and figured it out. THANKS AGAIN.
  23. Follow up question: what would be the best way of sending a final email with a message that would list all IDs that were contacted (in the loop of emails)? Is there a way to retain and call those IDs? Or do I need a 2nd while statement to re-capture that info again?
  24. Tested live and all confirmation messages printed as desired. Then waited for email. And waited. And worried. And waited. Then remembered a little thing called a spam folder. ROFLMAO. Emails were received and message contents corresponds accordingly. Thanks again. (I'll wait till next week to compare and educate.)
  25. Also, noticed that you left function clean_string at the bottom of script. Does this make it ineffective? Do I actually need it anyway (if variables are being validated before inserting into db?
×
×
  • 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.