Jump to content

bigsilk

Members
  • Posts

    104
  • Joined

  • Last visited

Everything posted by bigsilk

  1. I got a good solution from someone at stackoverflow.com: var things = ['attorney', 'insurance', 'financial', 'estate', 'trust', 'death']; var guide = {t1: 'attorney', t2: 'insurance', t3: 'financial', t4: 'estate', t5: 'trust', t6: 'death'}; $('#t1, #t2, #t3, #t4, #t5, #t6').click(function() { var clicked = $(this).attr('id'); $.each(things, function(_, thing) { var $thing = $('#' + thing); if (guide[clicked] == thing) $thing.show(); else $thing.hide(); }); }); Amazing how one job can be accomplished in so many ways...
  2. Works fine in Safari. However, while the image is yellow, the combo box shows 'Black' on load.
  3. Am working on a site that requires replacing data in <div class="foo"> that has <div id="foo_1"> ... <div id="foo_6">, where these divs have different data.So, here's what I've got: $('#t1').click(function() { $('#attorney').show(); $('#insurance,#financial,#estate,#trust,#death').hide(); }); $('#t2').click(function() { $('#insurance').show(); $('#attorney,#financial,#estate,#trust,#death').hide(); }); $('#t3').click(function() { $('#financial').show(); $('#attorney,#insurance,#estate,#trust,#death').hide(); }); $('#t4').click(function() { $('#estate').show(); $('#attorney,#insurance,#financial,#trust,#death').hide(); }); $('#t5').click(function() { $('#trust').show(); $('#attorney,#insurance,#financial,#estate,#death').hide(); }); $('#t6').click(function() { $('#death').show(); $('#attorney,#insurance,#financial,#estate,#trust').hide(); }); Surely there's an easier way to do this, and I'm pretty sure switch/case is the answer. I just don't know how to write it. I'm learning this stuff on my own and W3schools, while a great resource, doesn't have much in the way of showing how to create switch/case with the click function.
  4. I concur entirely. Absolute positioning will eventually bite you in the turdpucker, especially in different browsers.Add:.contentbox { background-color: #4E412D; height: 50px; width: 200px; margin-top: 20px; float:left; }Ooh, look! I just became a member!
  5. I'm trying to get a reaction from a radio button choice: If a person chooses 'Single', nothing happens. If they choose 'Married', an input box appears to allow them to enter their spouse's name. <html><head><script type="text/javascript"> { document.getElementById("answer"); } if (value = married) { document.write("Spouse's Full Name: <input type="text" size="20">"); }</script></head><body><form>Your Marital Status: <input type="radio" name="answer" onclick="check(this.value)" value="single">Single<input type="radio" name="answer" onclick="check(this.value)" value="married">Married<br /></form></body></html>
  6. I'm using phphMyAdmin, and no, neither of those, yet. I'm really just getting into php and MySQL and am taking small, incremental steps towards creating a robust, safe db. As for display entries, couldn't I just:<?php$con = mysql_connect("localhost","peter","abc123");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("my_db", $con);$result = mysql_query("SELECT * FROM Persons");while($row = mysql_fetch_array($result)) { echo $row['FirstName'] . " " . $row['LastName']; echo "<br />"; }mysql_close($con);?> As for deletion, not all records were dups. It was 'appending' only a portion of the table, sometimes 80 records, sometimes 104. I would still have had to go into phpMyAdmin and make sure all bad things were gone.I do have a page that returns a record based on a username, though. I'm going to use that as the edit record page, eventually.
  7. I haven't created the UPDATE form, yet. Only a form to return a record associated with a username and a form to insert a new record. I'm trying to wrap my head around validation right now.I deleted the duplicate records. I'll keep trying to duplicate the error and see what I did to make it happen.Stay tuned...A
  8. I have a db that's supposed to have 236 records in it. For some odd reason, it suddenly has 634 and most of them are duplicates. It's as though the table is replicating itself and appending itself to the beginning of that table. I know it's the beginning because the first four hundred or so don't have the password included in any of the fields and it's not on my input form, yet. Here's my form to retrieve records from a query based on a username: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head> <title>Edit Profile</title> <link href="CSS/profile.css" rel="stylesheet" type="text/css"> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <meta http-equiv="Content-Style-Type" content="text/css"></head><body><div class="centered_div"><div class="header">My Will Made Easy - Attorney Profile Editor</div><div class="profile_text"><?php$con = mysql_connect("localhost","###","###");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("bigsilkd_attorneys", $con);if (!empty($_POST['users'])){ $result = mysql_query('SELECT * FROM attorneys WHERE users=\'' . mysql_real_escape_string($_POST['users']) . '\'') or exit(mysql_error()); if ($row = mysql_fetch_assoc($result)) { ?>User Name: <input type="text" size="20" name="users" value="<?php echo $row['users']; ?>">Password: <input type="text" size="10" name="password" value="<?php echo $row['password']; ?>"> <br />Law Firm Name: <input type="text" size="60" name="LawFirmName" value="<?php echo $row['LawFirmName']; ?>"> <br />Main Office Address: <input type="text" size="60" name="MainOfficeAddress" value="<?php echo $row['MainOfficeAddress']; ?>"> <br />City: <input type="text" name="MainOfficeCity" value="<?php echo $row['MainOfficeCity']; ?>">ST: <input type="text" size="3" name="MainOfficeState" value="<?php echo $row['MainOfficeState']; ?>">Zip: <input type="text" size="10" name="MainOfficeZip" value="<?php echo $row['MainOfficeZip']; ?>"> <br />Main Phone: <input type="text" name="MainOfficePhone" value="<?php echo $row['MainOfficePhone']; ?>"> <br />Main Email Address: <input type="text" name="MainOfficeEmail" value="<?php echo $row['MainOfficeEmail']; ?>"> <br />Website Address: <input type="text" size="60" name="WebAddress" value="<?php echo $row['WebAddress']; ?>"> <br />Firm Overview: <textarea name='Overview' rows='5' cols='40'value="<?php echo $row['Overview']; ?>"></textarea><br />Years of Experience: <input type="text" name="YearsofExperience" value="<?php echo $row['YearsofExperience']; ?>"> <br />Languages Spoken: <textarea name='Languages' rows='5' cols='40'value="<?php echo $row['Languages']; ?>"></textarea><br />Geographical Areas Serving: <textarea name='GeographiesServing' rows='5' cols='40'value="<?php echo $row['GeographiesServing']; ?>"></textarea><br />Areas of Legal Practice: <textarea name='PracticeAreas' rows='5' cols='40'value="<?php echo $row['PracticeAreas']; ?>"></textarea><br />Primary Attorney's Name: <input type="text" name="MainAttorneyName" value="<?php echo $row['MainAttorneyName']; ?>"> <br />Primary Attorney's Phone Number: <input type="text" name="MainAttorneyPhone" value="<?php echo $row['MainAttorneyPhone']; ?>"> <br />Primary Attorney's Email Address: <input type="text" name="MainAttorneyEmail" value="<?php echo $row['MainAttorneyEmail']; ?>"> <br /> <?php } else { echo 'Username not found.'; ?><div class="profile_text"><form action="retrieve2.php" method="post"> User name: <input type="text" size="90" name="users" value="<?php echo $_POST['users']; ?>"></form> <?php }}else{ echo 'You must enter a user';}?></div></div></body></html> And here's what I'm using to input records: <?php$con = mysql_connect("localhost","###","###");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("bigsilkd_attorneys", $con);$sql="INSERT INTO attorneys (LawFirmName, MainOfficeAddress, MainOfficeCity, MainOfficeState, MainOfficeZip, MainOfficePhone, MainOfficeEmail, WebAddress, Overview, YearsofExperience, Languages, GeographiesServing, PracticeAreas, MainAttorneyName, MainAttorneyPhone, MainAttorneyEmail)VALUES('$_POST[LawFirmName]','$_POST[MainOfficeAddress]','$_POST[MainOfficeCity]','$_POST[MainOfficeState]','$_POST[MainOfficeZip]','$_POST[MainOfficePhone]','$_POST[MainOfficeEmail]','$_POST[WebAddress]','$_POST[Overview]','$_POST[YearsofExperience]','$_POST[Languages]','$_POST[GeographiesServing]','$_POST[PracticeAreas]','$_POST[MainAttorneyName]','$_POST[MainAttorneyPhone]','$_POST[MainAttorneyEmail]')";if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); }echo "1 record added";mysql_close($con)?>
  9. First, go to:Visit This PageEnter 'user1' for the User name. Don't worry about the password. Hit the Search button.On the next page, notice how the labels for the <textarea> are located at the bottom-left of the boxes. I want them to be top-left.
  10. Odd (loosely used) that it would not work in 8. 6 I can dig. I use a separate CSS for 6. Are you using the developer tools (F12) in 8 and setting it to view in 7 plain and quirks mode?
  11. I've several <textarea> on a page, and they are aligned to the bottom-left of the text area. I want them aligned to the top-left.
  12. NO TABLES!Have you tried floating everything left? float:left;
  13. Actually, it'sdb=bigsilkd_attorneystable=attorneyscolumn=usersIt works now...
  14. I got it. I was trying to pull from db 'bigsilkd_attorneys' and table 'bigsilkd_attorneys', where the table name was actually just 'attorneys'.YAY!Now I have to be able to update the fields if someone changes info in them. I'll see if I can't figure that out on my own (for a little while, anyway )
  15. It's only one table, 'bigsilkd_attorneys', and 'users' is one column.
  16. The error message coming back is:Table 'bigsilkd_attorneys.users' doesn't existBut I know the table exists because I'm able to add records to it. At least 'bigsilkd_attorneys' exists. Does '.users' indicate the column? Because if so, I know that column exists. Or is it trying to look for a table named 'bigsilkd_attorneys.users'?Here's an img of the db:As you can see, the table exists, as does the field 'users'.
  17. It really should be a separate form. People can choose between creating a new record or editing an existing one. I know I'll have to add an UPDATE somewhere on the editable form, but that can wait. For now, just getting the fields to populate with the 'users' record data will be victory enough. Here's what I've got now for the form to enter the search value: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head> <title>Profile</title> <link href="CSS/profile.css" rel="stylesheet" type="text/css"> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <meta http-equiv="Content-Style-Type" content="text/css"></head><body><div class="centered_div"><div class="header">My Will Made Easy - Attorney Profile</div><div class="profile_input"><form action="retrieve.php" method="post"> User name: <input type="text" size="90" name="users"></form></body></html> And the PHP: <html><body><?php$con = mysql_connect("localhost","***","***");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("bigsilkd_attorneys", $con);$users = '';$LawFirmName = '';$MainOfficeAddress = '';$MainOfficeCity = '';$MainOfficeState = '';$MainOfficeZip = '';$MainOfficePhone = '';$MainOfficeEmail = '';$WebAddress = '';$Overview = '';$YearsofExperience = '';$Languages = '';$GeographiesServing = '';$PracticeAreas = '';$MainAttorneyName = '';$MainAttorneyPhone = '';$MainAttorneyEmail = '';if (!empty($_POST['users'])){ $result = mysql_query('SELECT * FROM users WHERE users=\'' . mysql_real_escape_string($_POST['users']) . '\''); if ($row = mysql_fetch_assoc($result)) {$LawFirmName = $row['LawFirmName'];$MainOfficeAddress = $row['MainOfficeAddress'];$MainOfficeCity = $row['MainOfficeCity'];$MainOfficeState = $row['MainOfficeState'];$MainOfficeZip = $row['MainOfficeZip'];$MainOfficePhone = $row['MainOfficePhone'];$MainOfficeEmail = $row['MainOfficeEmail'];$WebAddress = $row['WebAddress'];$Overview = $row['Overview'];$YearsofExperience = $row['YearsofExperience'];$Languages = $row['Languages'];$GeographiesServing = $row['GeographiesServing'];$PracticeAreas = $row['PracticeAreas'];$MainAttorneyName = $row['MainAttorneyName'];$MainAttorneyPhone = $row['MainAttorneyPhone'];$MainAttorneyEmail = $row['MainAttorneyEmail'];} else echo 'Username not found.';}?><input type="text" name="LawFirmName" value="<?php echo $LawFirmName; ?>"> <br /><input type="text" name="MainOfficeAddress" value="<?php echo $MainOfficeAddress; ?>"> <br /><input type="text" name="MainOfficeCity" value="<?php echo $MainOfficeCity; ?>"> <br /><input type="text" name="MainOfficeState" value="<?php echo $MainOfficeState; ?>"> <br /><input type="text" name="MainOfficeZip" value="<?php echo $MainOfficeZip; ?>"> <br /><input type="text" name="MainOfficePhone" value="<?php echo $MainOfficePhone; ?>"> <br /><input type="text" name="MainOfficeEmail" value="<?php echo $MainOfficeEmail; ?>"> <br /><input type="text" name="WebAddress" value="<?php echo $WebAddress; ?>"> <br /><input type="text" name="Overview" value="<?php echo $Overview; ?>"> <br /><input type="text" name="YearsofExperience" value="<?php echo $YearsofExperience; ?>"> <br /><input type="text" name="Languages" value="<?php echo $Languages; ?>"> <br /><input type="text" name="GeographiesServing" value="<?php echo $GeographiesServing; ?>"> <br /><input type="text" name="PracticeAreas" value="<?php echo $PracticeAreas; ?>"> <br /><input type="text" name="MainAttorneyName" value="<?php echo $MainAttorneyName; ?>"> <br /><input type="text" name="MainAttorneyPhone" value="<?php echo $MainAttorneyPhone; ?>"> <br /><input type="text" name="MainAttorneyEmail" value="<?php echo $MainAttorneyEmail; ?>"> <br /></body></html> When I try to run it, I get this:Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/bigsilkd/public_html/will/retrieve.php on line 33Username not found.And line 33 is: if ($row = mysql_fetch_assoc($result))
  18. I'm a simple caveman.I don't know where to put the input field for the query itself. Here's what I've got: <html><body><?php$LawFirmName = '';$MainOfficeAddress = '';$MainOfficeCity = '';$MainOfficeState = '';$MainOfficeZip = '';$MainOfficePhone = '';$MainOfficeEmail = '';$WebAddress = '';$Overview = '';$YearsofExperience = '';$Languages = '';$GeographiesServing = '';$PracticeAreas = '';$MainAttorneyName = '';$MainAttorneyPhone = '';$MainAttorneyEmail = '';if (!empty($_POST['users'])){ $result = mysql_query('SELECT * FROM users WHERE users=\'' . mysql_real_escape_string($_POST['users']) . '\''); if ($row = mysql_fetch_assoc($result)) {$LawFirmName = $row['LawFirmName'];$MainOfficeAddress = $row['MainOfficeAddress'];$MainOfficeCity = $row['MainOfficeCity'];$MainOfficeState = $row['MainOfficeState'];$MainOfficeZip = $row['MainOfficeZip'];$MainOfficePhone = $row['MainOfficePhone'];$MainOfficeEmail = $row['MainOfficeEmail'];$WebAddress = $row['WebAddress'];$Overview = $row['Overview'];$YearsofExperience = $row['YearsofExperience'];$Languages = $row['Languages'];$GeographiesServing = $row['GeographiesServing'];$PracticeAreas = $row['PracticeAreas'];$MainAttorneyName = $row['MainAttorneyName'];$MainAttorneyPhone = $row['MainAttorneyPhone'];$MainAttorneyEmail = $row['MainAttorneyEmail'];} else echo 'Username not found.';}<input type="text" name="LawFirmName" value="<?php echo $LawFirmName; ?>"><input type="text" name="MainOfficeAddress" value="<?php echo $MainOfficeAddress; ?>"><input type="text" name="MainOfficeCity" value="<?php echo $MainOfficeCity; ?>"><input type="text" name="MainOfficeState" value="<?php echo $MainOfficeState; ?>"><input type="text" name="MainOfficeZip" value="<?php echo $MainOfficeZip; ?>"><input type="text" name="MainOfficePhone" value="<?php echo $MainOfficePhone; ?>"><input type="text" name="MainOfficeEmail" value="<?php echo $MainOfficeEmail; ?>"><input type="text" name="WebAddress" value="<?php echo $WebAddress; ?>"><input type="text" name="Overview" value="<?php echo $Overview; ?>"><input type="text" name="YearsofExperience" value="<?php echo $YearsofExperience; ?>"><input type="text" name="Languages" value="<?php echo $Languages; ?>"><input type="text" name="GeographiesServing" value="<?php echo $GeographiesServing; ?>"><input type="text" name="PracticeAreas" value="<?php echo $PracticeAreas; ?>"><input type="text" name="MainAttorneyName" value="<?php echo $MainAttorneyName; ?>"><input type="text" name="MainAttorneyPhone" value="<?php echo $MainAttorneyPhone; ?>"><input type="text" name="MainAttorneyEmail" value="<?php echo $MainAttorneyEmail; ?>">?></body></html>
  19. Ok, so I have a form to enter data into a db. But soon 2000 new records are going into this db and there is going to have be a way to search for, retrieve and edit records individually.I assume I'll use the SELECT FROM WHERE, but the tutorial explains it as WHERE is hard-coded into the request. The SELECT and FROM are given, of course.Baby steps.Can I use the same form used to create a new record in the db to display a record for editing? Or does it need to be a different form?This is the code from the tutorial. How do I make it so I can enter the WHERE and SUBMIT it to query the db and return the results in a form for editing? Here's an example of the form I want to be able to edit the record with.View the formIt's the input form. So, what I'm looking to do is to be able to type in a unique identifier (username), click SUBMIT to find the record, and have it populate the form fields for editing and then allow the user to UPDATE the record.
  20. Using PHPMyAdmin did the trick. Didn't even know it was there or what it was for. Thanks.I'll be back, rest assured...A
  21. I didn't see a 'create table' option in the MySQL wizard in my cPanel, else I would have done so.I uploaded the 'CREATE TABLE' page and opened it in a browser window, thinking that would get it to run. No love there.Is there something else I have to do to get it to run?
  22. I set up a db in MySQL through cPanel. It's there. I see it.I'm trying to create a table in which to store data from an online form.I'm not quite sure how to create the table in the db. I believe I have the right code: But when I fill out the form and hit the Submit button: (There's more to the form, I'm just excluding it for the sake of cleanliness.)I get this:Error: Table 'bigsilkd_attorneys.attorneys' doesn't existI assume that CREATE TABLE needs to be run once, but I'm not sure how to get it to run, or whether or not I was successful. It's apparent I wasn't.Here's insert.php:
  23. I have my swfobject in the same directory as my index.html. I also have another flash embed on another page in the same directory. Both call for swfobject. But when I uploaded the second one, the movie on my index page stopped working.I thought swfobject worked on all flash embeds, no?I had to point one page to another directory to get both movies to work.
×
×
  • Create New...