Jump to content

phppup

Members
  • Posts

    644
  • Joined

  • Last visited

Everything posted by phppup

  1. Works GREAT!!!! Thanks again. [yes, did internet search last night and got a better understanding] Enjoy the holiday cheer.
  2. Not having much luck with double quotes inside the double quotes. It seems as though the script is interpreting the second double quotes as the end of the statement rather than a continuation. Am I missing some sort of syntax rule? Is there a requirement of double-single-double (or similar) in order to work along those lines?
  3. Thanks for the additional info. I will give it a try. I hadn't realized that the '(?)' was for the prepared statement. I thought it was for me to add parameters of my own. The shortcuts in PDF tend to confuse me. Thanks again.
  4. Thanks, but it may be a little over my head (although I think I have a slight understanding). Any web-links that might help me grasp this better? PS: in case we get busy, let me wish you a Happy Holiday and joyous New Year now.
  5. It would be GREAT if someone could provide some specific structural info for this: I have one checkbox each for Moe, Larry, and Curly respectively. I have managed to assemble code that allows for each of their names: $sql="INSERT INTO $table (first_name) VALUES... It works great INDIVIDUALLY. But I want to be able to insert any combination into the $table by checking the respective checkboxes and submitting the form. It seems that initiating more than a single INSERT will not get the job done, and separating the values as variables hasn't worked either. What is required? Can you offer an example?
  6. No combination of single or double quotes is correcting the situation. In fact, it tends to render the alert inoperable.
  7. I added quotes to the TYPE attribute, but nothing changed. Adding either single or double quotes to the ALERT render it totally inoperable. document.write("<input type='radio' onclick=alert('Hello World');> Click here and alert FAILS") Can you be more specific?
  8. I have two nearly identical radio button inputs that trigger JS alerts. The alert message will ONLY work when there are NO SPACES in the message. What am I doing wrong? What is the solution so that a message WITH spaces will be visible? <!DOCTYPE html> <html> <body> <p>Click the button get the text content of the button element.</p> <button onclick="myFunction()" id="myBtn">Tryit</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myBtn").textContent; document.write("<input type=radio onclick=alert('HelloWorld');> Click here and alert works") document.write("<br><br><br><br>") document.write("<input type=radio onclick=alert('Hello World');> Click here and alert FAILS") //the ALERT will FAIL because of the SPACE between "Hello World" document.getElementById("demo").innerHTML = x; } </script> </body> </html> You can copy the code and wee for yourself. Please advise.
  9. Made several adjustments but don't seem to be hitting the mark. <form name="form"> <b>What do you like best?</b><br> <input type="radio" name="group1" id="male" value="mommy" checked> <label for="male">i want to see this: mommy hands</label><br> <input type="radio" name="group1" id="female" value="toys"> <label for="female">i want to see this: toys and talking</label><br> <input type="radio" name="group1" id="other" value="monkeys"> <label for="other">i want to see this: monkeys and tigers</label><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(); group1Checked = document.querySelector("label[for='" + this.id + "']") } } if(group1Checked){ //if(group1Check) is just saying, "if group1Checked does not equal null" alert("I like " + this.id + " best.") } else{ alert("You did not make a selection.") } } </script> Can anyone get this to run so that it delivers the label TEXT in the alert? Currently, I get "You did not make a selection" even though choices are picked.
  10. If I could have, I would have, but I didn't because I needed assistance. That's why I posted in the first place.
  11. Edited my code as suggested but no luck. <form name="form"> <b>What do you like best?</b><br> <input type="radio" name="group1" id="male" value="mommy" checked> <label for="male">i want to see this: mommy hands</label><br> <input type="radio" name="group1" id="female" value="toys"> <label for="female">i want to see this: toys and talking</label><br> <input type="radio" name="group1" id="other" value="monkeys"> <label for="other">i want to see this: monkeys and tigers</label><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(); group1Checked = document.querySelector("label[for='" + this.id + "']") } } 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> Any suggestions?
  12. I think I'm liking the label option. It seems more efficient, especially since I was planning to add a <label for> to extend mouse focal area. (Does this sound reasonable?) How would I adapt my JavaScript [shown above] after this modification?
  13. 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.)
  14. 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.
  15. I understand that a span is not a form element, but isn't the JS creating a variable that can be 're-shaped'?
  16. 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.
  17. 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?
  18. 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?
  19. Sorry, missed that lone word sitting there all by itself. So it's been a futile effort. Good to know LOL
  20. 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.
  21. 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.
  22. 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.
  23. 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.
  24. 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).
  25. 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?
×
×
  • 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.