Jump to content

SephirGaine

Members
  • Posts

    44
  • Joined

  • Last visited

    Never

Everything posted by SephirGaine

  1. [b]shadowcaster[/b]: Just in the same page will work fine. So preferably, that'll be my route. [b]snorkler[/b]: That was an idea that came to mind, but it seems to be a lot more work than deems necessary. If there's a way to basically have 2 submit buttons on a single form, each leading to different pages, that'll save me time, effort, and probably a bit of frustration to do it that way. If this falls through that's what I'll do however.
  2. Hey ya'll.  Basically, I want to have two submit buttons, each going to a different page. I figure I'll lead one like normal, and have it go to my action="" page. But, my second one I want to go to a seperate page. I understand that Javascript works for this using the onClick tag, but I haven't been able to get it working. So far.. [code]onClick="parent.location='closelead.php'[/code] That's what I'm working with. Any help would be appreciated.
  3. Ah, disregard that, sorry. Got it figured out. What was happening, however, was that when I took out "where Date='$LeadYear2' AND Dead=0 ORDER BY '$LeadSort' ASC"" it would display all the results within that table like it should, and as soon as I placed the rest of the query back in and tried, nothing would show. It was basically just a stupid mistake on my own part, however. Thanks.
  4. Unfortunately I'm not sure what's exactly wrong, but just for troubleshooting goodness, try with a different browser. If that doesn't work, try running the script on a different machine entirely. I'm sure it'll be easier to pin down what the problem is if you can figure out whether it's a problem with the code itself or a system/security/firewall problem. I can imagine a lot of things can prohibit programs from running remotely off of a script.
  5. One more quick question. Having trouble displaying the entries now, narrowed it down to something in my mysql query. I've looked over it too many times to count and I'm not too sure what's wrong, however. [code]"SELECT * FROM Leads where Date='$LeadYear2' AND Dead=0 ORDER BY '$LeadSort' ASC"[/code]
  6. Hola. Just a quick question, should be easy to answer, and needless to say I feel real amateur not knowing the answer. However, I want to echo all data entries from a DB table, however I want to be able to filter through using two variables. One is easy enough, simply use SELECT X from Table WHERE Y=Z. But, I want to use two WHERE variables in the same string. What's the proper way to do so? And if it's actually needed, I need to select these from a certain year, and whether or not they're open tickets at the time. So, for this mini-project, "Date" and "Dead" are going to be my two variables I want to filter through.
  7. Awesome, I'll take a look, thanks. I just found out that I'll end up needing to use it for something else ANYWAYS, but for now I've got the system working OK for what I had originally planned. This'll definitely help me out with the next part, however. Thanks!
  8. Aye, I might just go both routes. For now, just code it using HTML/PHP and then go back at a later date and use Ajax. Reading up a bit on it right now, it's similar to XHMTL, no? If so I know jack about it.. but hey, less than 3 months ago I knew 0 about PHP as well. Thanks for pointing me in the right direction, though!
  9. Ajax, heard of it, not sure what it is. I'll do a quick search, though. I s'pose I can have them submit it and then generate it from there, would probably be quicker (and easier) to populate the fields without having to submit first, though.
  10. Hey ya'll. This is what I want to do. I've got a form where an employee inserts a customer's information for a work order. Ideally, what I want, is for them to be able to save the information into a database. That's the easy part. However, I'm going to have a drop-down list of all the customers we have saved (once again, easy part), but if they choose one of the customers from this list, it automatically fills in the customer information from the database. However, I'm not sure exactly how to do this.. perhaps this is more of an HTML question than PHP. I know how to do everything except for making the form parts automatically fill themselves in depending on which option they choose. So.. any help/guidance/STFU will help. Thanks!
  11. Most unfortunately.. [quote]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 'SELECT IF(Invoice='Yes','No','Yes')) where work_order_num='2''[/quote] This is what I've got.. [code]<?php   $query = "UPDATE `WOR` SET Invoice=(SELECT IF(Invoice='Yes','No','Yes')) where work_order_num='$ordernum'"   ?>   <?php mysql_query($query) or die(mysql_error()); ?>[/code]
  12. Hate to be a pain, but bumpin' 'dis. Still having a bit of trouble.. see one post up.  ???
  13. Hm.. getting a syntax error when I try it. I get the idea though, so thanks! Changed what you gave me just a bit, came up with this.. [code]<?php   $query = "UPDATE `WOR` SET Invoice=Yes where work_order_num='$ordernum' AND Invoice=No";   $query .= "UPDATE `WOR` SET Invoice=No where work_order_num='$ordernum' AND Invoice=Yes";   ?>   <?php mysql_query($query) or die(mysql_error()); if (mysql_affected_rows() == 0) { echo("An error has occured."); } ?>[/code]
  14. Although I can't exactly pinpoint where you went wrong, I can give you what I'm using for an email form-submittal. Hopefully you can take a look as maybe find out where your code might be off? Might be a little bit messy, but I tried to keep it as clean and simple as possible. [code]<?php $EmailFrom = "myemail"; $EmailTo = "myemail"; $Subject = "Contact Form Submittal"; $Name = Trim(stripslashes($_POST['Name'])); $Company = Trim(stripslashes($_POST['Company'])); $Email = Trim(stripslashes($_POST['Email'])); $Telephone = Trim(stripslashes($_POST['Telephone'])); $Message = Trim(stripslashes($_POST['Message'])); $validationOK=true; if (Trim($Telephone)=="") $validationOK=false; if (!is_numeric($Telephone)) $validationOK=false; if (!$validationOK) {   print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";   exit; } $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Company: "; $Body .= $Company; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; $Body .= "Telephone: "; $Body .= $Telephone; $Body .= "\n"; $Body .= "Message: "; $Body .= $Message; $Body .= "\n"; $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); if ($success){   print "<meta http-equiv=\"refresh\" content=\"0;URL=success.html\">"; } else{   print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">"; } ?>[/code]
  15. A week probably won't get you too far. I've been dealing with PHP (or trying to) for about 2-3 months now, and I'm still getting stumped on the easiest things. For the most part it's been trial by fire for me, however these forums have helped me immensly so far in developing my PHP skills. Look up some basic tutorials, create some basic scripts, and then plan out what you want to do with PHP. Try to do whatever you can by yourself, and if you become hopelessly stuck or confused somewhere, feel free to ask. It's worked thus far for me.. and though I'm still moving my site along at a snail's pace, I'm learning PHP as I go and each time I create a script I get less, and more minor problems because of it.
  16. Whooptie. I'm back (unfortunately, again), however this time my question's a lot different. I'll start off by posting my code.. [code]<?php $query1 = "UPDATE `WOR` SET Invoice=Yes where work_order_num='$ordernum' where Invoice=No"; $query2 = "UPDATE `WOR` SET Invoice=No where work_order_num='$ordernum' where Invoice=Yes"; ?> <?php if (mysql_query($query1) or die(mysql_error()) else { mysql_query($query2) or die(mysql_error(); } ?>[/code] What I want to do is to basically switch the "Invoice" section of an entry to Yes or No, much like a toggle. However, I'm running into a few problems when I try to run the script. Unfortunately I'm not sure where I've gone wrong. I can see it being either I can't use 2 "where" statements in a single query, or it's in my else statement (syntax error somewhere). Any help would be appreciated, and if there's a simpler way for me to do this, I'm all ears. This is just what I came up with off the top of my amateur head. Thanks!
  17. ..d'oh! That was simple enough. Thank god you guys can see what I'm too ignorant to notice.  ;) Thanks for the catch, and all the help!
  18. [b]Barand,[/b] brilliant! The first part works just cool now, all the information is in the drop-down box and they all display correctly. However, the work order number is still having trouble being carried over to the next page. I've got the select name as prevwor3, and have this: [code]<?php $ordernum =  $_POST['prevvor3']; ?>[/code] Inside of prevwor.php. However, nothing is being assigned to the variable it seems. Nothing shows when I attempt to echo it.
  19. Yeah. Most unfortunately. However, they [b]should[/b] be simple fixes, so I'll keep my fingers crossed for now and probably slap myself later when I realize how simply I messed up. BUT, here's what I've got. A dropdown box within a form. Within this dropdown box, it recalls data from a database. A work order number, the customer name, and whoever assigned that work. They select which work order they want to view, click submit, and it goes to an HTML file that generates the rest. I've got two problems that have stemmed since I've attempted this. The first, is that not all the word orders are displaying. When I had the list consisting of JUST the word order number, it displayed every work order within the database. However when I added more strings to the option, it only displays the first one. My second problem. I'm trying to assign the order number to a variable so I can carry it over to the next page. This is where I feel very, very stupid. I've used variables off of forms perfectly, however I figured just using $_POST on the first page and $_GET on the next would work. I was wrong apparently. Without further ado.. here's my code. [code]<form action="prevwor.php" method="post"> <select name="prevwor3"> <?php $query = "SELECT * FROM WOR"; $resource = mysql_query($query) or die("Error: ". mysql_error() ." in query"); if ($resource !== FALSE) {   if ($num_open = mysql_fetch_assoc($resource))   {     echo '<option>'.$num_open['work_order_num'].' - '.$num_open['Customer'].' - '.$num_open['EmpName'].'</option>';   } } ?> </select> <?php $prevwor = $num_open['work_order_num']; $_POST["$prevwor"]; ?>[/code] And for the next page, pertaining to the second problem.. [code]<?php $ordernum = Trim(stripslashes($_POST['$prevwor'])); ?>[/code] Thanks in advance!
  20. You said that you're already getting the username and password from a database through PHP, right? All you really need to do now is assign those two things to $user and $pass variables. No need to change the code as it is, just need to clarify your own code a bit to connect what mewhocorrupts gave you to what you already have.
  21. And that's why you guys rock. Changed it with IF, and it works [b]flawlessly[/b]. Gotta love it. Thanks a ton for the help! Think I can finally stop making topics, since my real major project on the site is working just fine!  ;D ;D ;D
  22. Ah, that's just the thing though, all three of the mentioned queries are working perfectly, it's when I'm setting the variables where something gets messed up. I'll give it a shot nontheless and see if anything turns up. EDIT: Yeah.. this is what it prints.. [code]UPDATE `WOR` SET EmpName='',EmpPhone='',EmpEmail='' where work_order_num='24'[/code] Which is pretty much what it should be. It recognizes the $work_order_num variable, but the rest have nothing -- so the problem is 99% going to be somewhere in.. [code]<?php $EmpName = $text['name']; $EmpPhone = $text['phone']; $EmpEmail = $text['email']; ?>[/code] That.
  23. Alright. I changed INSERT with UPDATE, and added an error report that actually reports something. So, thanks for the tips thus far -- just a shame I kept forgetting to do so beforehand. I managed to run the query in phpmyadmin and it worked successfully, however it still is not seeing the variables it seems, as when I substituted my variables in my query with regular text (put in Test1, Test2, Test3) it worked perfect. So at least my query isn't jacked up anymore, so I guess that's a semi-good sign.. [code]<?php $query = "SELECT * FROM `EMPLOYEES` where loginName='$logname'"; $result = mysql_query($query) or die("Error ". mysql_error(). " with query empinfo");; while ($text = mysql_Fetch_assoc($result)) { echo ''.$text['name'].'<br> '.$text['phone'].'<br> '.$text['email'].'';   } ?> <?php $EmpName = $text['name']; $EmpPhone = $text['phone']; $EmpEmail = $text['email']; ?> <?php $query = "SELECT * FROM `Techs` where Name='$Tech'"; $result = mysql_query($query) or die("Error ". mysql_error(). " with query techinfo"); while ($text = mysql_fetch_assoc($result)) { echo ''.$text['Name'].'<br> '.$text['Phone'].'<br> '.$text['Email'].''; } ?> <?php $TechPhone = $text['Phone']; $TechEmail = $text['Email']; ?> <?php $query2 = "UPDATE `WOR` SET EmpName='$EmpName',EmpPhone='$EmpPhone',EmpEmail='$EmpEmail' where work_order_num='$work_order_num'"; mysql_query($query2) or die("Error ". mysql_error(). " with query query2"); ?>[/code] That's what I've got. All of the Employee and Tech information echo correctly, but it appears that I messed up when trying to assign variables to them. So, I guess this goes right back to my original post.. but at least there's a light at the end of the tunnel, more or less. Hopefully I can stop bugging you guys soon.  ;) Thanks a crapload for the help thus far, much appreciated per usual. I'll have to drop a donation to the site sometime, love the assistance I've gotten from you fine folk. EDIT: Oh, and I took out $TechPhone and $TechEmail out of my query for now, until I can get this knocked out, then I'll place them back in.
  24. Hm.. my query dies when I try to insert the information.. not too sure why? Any help would be appreciated.. [code]<?php $query = "SELECT * FROM `EMPLOYEES` where loginName='$logname'"; $result = mysql_query($query) or die(mysql_error()); while ($text = mysql_Fetch_assoc($result)) { echo ''.$text['name'].'<br> '.$text['phone'].'<br> '.$text['email'].'';   } ?> <?php $EmpName = $text['name']; $EmpPhone = $text['phone']; $EmpEmail = $text['email']; ?> <?php $query = "SELECT * FROM `Techs` where Name='$Tech'"; $result = mysql_query($query) or die(mysql_error()); while ($text = mysql_fetch_assoc($result)) { echo ''.$text['Name'].'<br> '.$text['Phone'].'<br> '.$text['Email'].''; } ?> <?php $TechPhone = $text['Phone']; $TechEmail = $text['Email']; ?> <?php $insert_info = "INSERT into `WOR` where work_order_num='$work_order_num' (EmpName,EmpPhone,EmpEmail,TechPhone,TechEmail) VALUES ('$EmpName','$EmpPhone','$EmpEmail','$TechPhone','$TechEmail')"; mysql_query($insert_info) or die("Unable to submit query insert_info."); ?>[/code]
×
×
  • 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.