Jump to content

shanetastic

Members
  • Posts

    23
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

shanetastic's Achievements

Member

Member (2/5)

0

Reputation

  1. I was only showing a simplified version of the page. The full version sets the action to one of multiple things based on some criteria.
  2. Solved. Changing the href to: <a href='javascript:if(OnSubmitForm())document.myform.submit()'> gets it working!
  3. I don't believe that is correct. The javascript that is called sets the action (at least it is supposed to). If I use a traditional submit button (a submit input field inside the form) it works fine.
  4. Here is the code for test.html: <html> <head><title></title></head> <body> <script type="text/javascript"> function OnSubmitForm(){ document.myform.action ="insert.html"; return true; } </script> <form name="myform" onsubmit="return OnSubmitForm()" method="get"> <input type='radio' name='Search' value='test'>test</input> </form> <a href='javascript:document.myform.submit()'><img src='images/buttonnext.jpg'></a> </body> </html> The way I want it to work: when the img (buttonnext.jpg) is clicked, the form is submitted. When the form is submitted it runs the javascript, which sets the action to be that insert.html is loaded. i.e. the end result should be to redirect to insert.html?Search=test The way that it is working now: the page is redirected to test.html?Search=test What do I need to change to accomplish my goal?
  5. $Rep = htmlspecialchars($_GET["Rep"]); echo $Rep; The above will print "John Doe & Assoc." (without the quotes) $result = mysql_query("SELECT RepName FROM Reps WHERE Repname = '".$Rep."'"); $repcount = mysql_num_rows($result); echo $repcount; The above code prints "0" If I delete the first block of code and replace it with $Rep = "John Doe & Assoc." The second block of code will then return a "1" as it should. Why is one returning a 0 and one returning a 1 when the text in $Rep appears to be identical in both cases? This problem only appears to be occurring when the $Rep value contains an &.
  6. First, thank you both for your responses. However, it turns out my original query works fine...it was more of an id10t error. I was using the "explain" button in Navicat thinking it was a trace button (I didn't want to actually run the delete until I had all the bugs worked out). I did not realize that that EXPLAIN is an actual mysql command....and that that command isn't compatible with DELETE *facepalm*
  7. I am getting this error: [Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELETE FROM Territories USING Territories, Reps, States, Principals WHERE Terr' at line 1 When I try to run this query: DELETE FROM Territories USING Territories, Reps, States, Principals WHERE Territories.RepID = Reps.RepID AND Territories.PrincipalID = Principals.PrincipalID AND Territories.StateID = States.StateID AND Reps.RepName = 'CompanyA' AND Principals.PrincipalName = 'CompanyB' AND States.StateAbbreviation LIKE '%NC%'; What am I doing wrong Here are my table structures: Reps ------ RepID RepName Principals ----------- PrincipalID PrincipalName States -------- StateID StateAbbreviation Territories ------------ RepID PrincipalID StateID
  8. Am I getting warmer? INSERT INTO Territories (RepId, PrincipalID, StateID) JOIN StatesON Territories.StateID = States.StateID JOIN Reps ON Territories.RepID = Reps.RepID JOIN Principals ON Territories.PrincipalID = Principals.PrincipalID SELECT Reps.RepID as RepID Where Reps.RepName = 'ARepName' SELECT Principals.PrincipalID as PrincipalID Where Principals.PrincipalName = 'APrincipalName' SELECT States.StateID as StateID Where States.StateAbbreviation LIKE '%LA%'
  9. Here is my query: INSERT INTO Territories (RepId, PrincipalID, StateID) SELECT Reps.RepID Where Reps.RepName = 'ARepName' SELECT Principals.PrincipalID Where Principals.PrincipalName = 'APrincipalName' SELECT States.StateID Where States.StateAbbreviation = 'LA' I have four tables: Reps ------ RepID RepName Principals ----------- PrincipalID PrincipalName States -------- StateID StateAbbreviation Territories ------------ RepID PrincipalID StateID I know the RepName, PrincipalName, and StateAbbreviation. I am trying to use those to pull the respective IDs from the respective tables and then insert a row into Territories. What am I doing wrong?
  10. Glad I asked before I started coding some ridiculous method! So it looks like all I have to do is use action=destination.php and method=post. I thought form data had to be passed in the URL unless you used a script to do something like a was proposing. This is obviously much easier. Thanks!
  11. I have a page that has roughly 100 text input fields. Once the user is done, I need to put the data in my mysql db. How do I get the data from the user input page to the php page that will process the data (e.g. process.php)? I've done some searching and found a few possibilities [*]use a ajax style call back to load a seperate asp page (e.g. createsession.asp) and that page set session variables that can then be read by process.php [*]write everything to a cookie using some sort of a delimiter so that it can handle multiple variables (e.g. cookie data => var1/var2/var3/var4... [*]write all the data to a text file and then have process.php load that file Which should I pursue? Is there a better option?
  12. Yes, I had tried several attempts at JOINs, but I was missing the "ON" statement. Now that I have that piece of the puzzle it is working perfectly
  13. I know this is basic, but I cannot figure it out. Here are my tables: Rep ----------- RepID (PK) RepName RepURL Company ----------- CompanyID (PK) CompanyName CompanyURL CompanyDescription States ----------- StateID (PK) StateAbbreviation StateName Territory ---------- RepID (PK) CompanyID (PK)* SateID (PK)* *these two columns will be made into a unique index. I would like a query that searches the Territories table and returns States.StateAbbreviation and Company.CompanyName for a given RepName. So is the RepName = "Rep1", the query should look in the Reps table and get the corresponding RepID. Then it should return all of the rows in Territories that match that RepID. Except I would like it to look at the States and Company tables so to return the StateAbbrevation and CompanyName rather than the IDs that are used in the Territories table.
×
×
  • 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.