Jump to content

apellegrino

Members
  • Posts

    7
  • Joined

  • Last visited

apellegrino's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. They want "Your menu selection was Pets!" and a "Pets" h1. Anything else I want removed. So for instance, within the table there is "Pets" at the top, "P" in the middle, and "Pets" again. I want the last two removed "P" and the 2nd "Pets".
  2. This is just a beginner's php class, probably why they haven't taught us about prepared statements. I honestly don't know if the if statement is required, but it was in the code they supplied. Now they're asking to place an H1 heading to the page. Meaning if a user clicks on one the categories, than the heading specifies which category they're viewing; but there is multiple headings within the table, and I only want one. Does that help?
  3. In my class we are to insert an H1 heading into our webpage using PHP. I have the code, but I can't figure out how to remove the multiple headings within the table. Everything in the code is what is required. Attached is an image of the page. Please help<!-- This first line is used to get the database connection information --><?php require_once('dbconnect.php'); ?><?php//The SELECT statement is pulling two columns (content and cat_name) from the table name and ad_table//The only row(s) being returned are rows where the cat_code is equal to the numeric value being passed from the categories menu selection$cat = (isset($_GET['cat']) ? $_GET['cat'] : null);$result = mysqli_query($link, "SELECT content, cat_name FROM ad_table WHERE cat_code='$cat'");if (!$result){$error = 'Error fetching data: ';$e= mysqli_error($link);echo ('bad results');echo($e);//exit();}else{$heading = "xxxx"; // sets heading to garbage so can display correct headingwhile ($row = mysqli_fetch_array($result)){if($heading != $row['cat_name']) { //checks to see if heading is different//?> <h1><?phpecho $row['cat_name']; ?></h1><?php$heading = $row['cat_name'];}// table to dispaly content results?><table width="400" border="1" cellpadding="0"><tr><td><?php echo $row['content']; ?></td></tr></table><?php} // ends the while loop} // ends the if statement?>
  4. Yes, I actually removed this line, because it's not needed. But I'm still receiving the "Must contain an uppercase character" message when an uppercase letter has been inputted. Any idea on how to fix that. Here is my code again with the code line removed. <script type="text/JavaScript">function chkPwd() {var pwd = document.form1.pwd;var pwdMsg = document.getElementById('pwdMsg'); regex = /[A-Z]/;var pwd1 = pwd.value;pwdMsg.innerHTML = "Must contain at least one uppercase character"pwd.select();return;} </script></head> <body><form name="form1" action="" method="post"><p> Password: <br><input type="text" name="pwd" onchange="chkPwd()" /><span id="pwdMsg"></span></p><p><input type="button" value="chkPass" onclick="chkPwd()"></p></form><div id="results"></div></body></html>
  5. Well to be honest...I'm a little confused. The input box shows up, and if I insert a "A" I still get the "Must contain at least one uppercase character". How do I fix this? I have used the browser consoles (chrome and firefox) to check for errors, but I am not getting any.
  6. In my class, I need to develop a simple JavaScript form for the user to input alphabetic characters, and than check to see if both Uppercase and Lowercase characters are used. This is what I have so far for the code, but I'm completely lost on why it's not working the way I need it to. Below are the exact instructions, I'm not looking for you to complete my code, just give me a few hints on where to go with this. Write a JavaScript program that ensures that user input contains only upper or lower case letters by using the String object and the RegEx object (regular expression). Construct a regular expression using the RegEx object that checks for upper or lower case letters only. Add the JavaScript statements. Add the JavaScript statement to accept text input from the user. Add the JavaScript statement, and use either the search() or match() methods to check the input string and then write the answer to the screen. <script type="text/JavaScript">function chkPwd() {var pwd = document.form1.pwd;var pwdMsg = document.getElementById('pwdMsg'); regex = /[A-Z]/;var pwd1 = pwd.value;if(pwd1.search(regex -- -1)) {pwdMsg.innerHTML = "Must contain at least one uppercase character"pwd.select();return;}else{ pwdMsg.innerHTML = "";}} </script></head> <body><form name="form1" action="" method="post"> <p> Password: <br><input type="text" name="pwd" onchange="chkPwd()" /><span id="pwdMsg"></span></p><p><input type="button" value="chkPass" onclick="chkPwd()"></p></form><div id="results"></div></body></html> Thanks!
×
×
  • Create New...