Jump to content

manuelV

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

manuelV's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. manuelV

    Drawing a line

    Can you use the <hr> tag?
  2. Hi, when I had just started making my website, I started making it on our Ubuntu server. Using ems as my measurements everything was working fine. But when I went to look at the page on Windows everything was out of place and didn't look the same as in Ubuntu. Same thing happened when I switched to Windows, when I went to look at the page in Ubuntu, everything was unaligned.. Using Firefox with Ubuntu. Does anyone know the cause for this?
  3. Right, I'm just not exactly how to go about that in code form.. :-\
  4. The way it works is, say we there's the boxes with ID from 1-7. And they choose 2,4,5. It would then insert 3 rows into the table, with the index ID being 'auto increment', but the other ID being 2,4,6. So the method you suggested wouldn't work in this case.
  5. Hi, basically, here's the deal: I have a lit of checkboxes that are added by the admin (there's an unlimited amount, just depends on how many are added). Then, those are put in a form, in which the user picks whichever ones need to be chosen and those values get sent to a MySQL table. Here's the code that displays the checkboxes <?php $sql="SELECT * FROM category ORDER BY categoryID ASC"; $result=mysql_query($sql); while($row=mysql_fetch_array($result)){ echo "<input type='checkbox' id='". $row['categoryName'] ."' name='licensed[]' value='" . $row['categoryID'] ."' /><label for='". $row['categoryName'] ."'><br>" . $row['categoryName'] ."</label><br>"; } ?> What I'm making now, is an edit form where whichever checkboxes were checked, will show up checked in the edit form. But I'm not really sure how to go about this, since there is only one actual input tag in the code, I can't select the different ones. I also have this SQL query which selects whichever boxes were inputted into the DB $sql2="SELECT * FROM category, categoryInfo WHERE category.categoryID = categoryInfo.categoryID AND categoryInfo.parentID = $parentID"; $result2=mysql_query($sql2); Where $parentID is the ID of whichever form you're editing. But yes, I'm basically not really sure how to go about this and would like some help figuring this out Thanks for your time
  6. Wow, I can't believe it was that simple... I actually just forgot to add the method. I added POST and it works now..
  7. Yes it does. I managed to get it to work like this <?php $myInputs = $_POST["myInputs"]; $myInputs2 = $_POST["myInputs2"]; foreach($myInputs as $k=>$eachInput) { $eachInput2 = $myInputs2[$k]; mysql_query("INSERT INTO contactInfo (contactValue, contactType) VALUES ('$eachInput2','$eachInput')"); } ?>
  8. Hi, I wanna start out by saying that I know very limited and that I did not come up with this code (Although I edited it to fit what I needed) the code basically, what it does is the person picks one out of four radio buttons, and depending on which button they choose, a dropdown menu will show different values. But when I hit the "Send" button, all the variables and values of the Inputs inside the form are sent into the URL. How come it's doing this? Is there a way to stop this from happening, in such a way that it just sends you to the other page like it's supposed to? This is the code <script language="javascript"> window.document.getElementById("noOptions").style.display = "block"; window.document.getElementById("allOptions").style.display = "none"; function changeOptions() { var form = window.document.getElementById("form"); var north = window.document.getElementById("north"); var south = window.document.getElementById("south"); var metis = window.document.getElementById("metis"); var general = window.document.getElementById("general"); window.document.getElementById("noOptions").style.display = "none"; if (form.radioButton1.checked) { south.style.display = "none"; general.style.display = "none"; metis.style.display = "none"; north.style.display = "block"; north.selectedIndex = 0; } else if (form.radioButton2.checked) { north.style.display = "none"; general.style.display = "none"; metis.style.display = "none"; south.style.display = "block"; south.selectedIndex = 0; } else if (form.radioButton3.checked) { north.style.display = "none"; general.style.display = "none"; south.style.display = "none"; metis.style.display = "block"; metis.selectedIndex = 0; } else if (form.radioButton4.checked) { north.style.display = "none"; metis.style.display = "none"; south.style.display = "none"; general.style.display = "block"; general.selectedIndex = 0; } } window.document.getElementById("radioButton1").onclick = changeOptions; window.document.getElementById("radioButton2").onclick = changeOptions; window.document.getElementById("radioButton3").onclick = changeOptions; window.document.getElementById("radioButton4").onclick = changeOptions; </script>
  9. Basically I have this code <?php $myInput = $_POST["myInput"]; // these have more than one value to it $myInput2 = $_POST["myInput2"]; foreach ($myInput as $eachInput ) { echo $eachInput ."<br>"; } foreach ($myInput2 as $eachInput2 ) { echo $eachInput2 ."<br>"; } ?> This code will input however many values are gathered from the $_POST. Works just fine. But what I need is for there to be one foreach loop, as supposed to two. I need both of those to be in a single foreach. Is there a way of doing this? Reason for this is the values will be inserted into a SQL table, in two different columns. So I need to be able to do it with a single query! Any help is appreciated
  10. and used this for selecting the SQL $sql="SELECT * FROM clients ORDER by clientName"; $result2 = mysql_query($sql); $sql="SELECT clients.clientID,clients.clientName, workOrder.clientID FROM clients, workOrder WHERE workOrder.clientID = clients.clientID AND workOrder.workOrderID = $workOrderID "; $result3 = mysql_query($sql); Like WebStyles mentioned, the INNER JOINs were a bit 'much'. This does the exact same thing, and isn't nearly as 'complex'
  11. We got it to work!!! (there was 2 of us trying to figure this out ) Here's the code, thanks very much for your help! MUCH appreciated! <?php $row = mysql_fetch_array($result3); $selectedID = $row["clientID"]; while($row=mysql_fetch_array($result2)){ $option .= "<option value = '{$row['clientID']}'"; if ($row['clientID']==$selectedID) $option.= " selected"; $option .= ">" . $row['clientName'] . "</option>"; } ?>
  12. Hmm, I tried the code and adding the $options.= seems to have helped a bit. However, it only ever selects the very last option for some reason :s Also, I'm not entirely sure how to access the server log at the moment. (I'm using FTP to access the files) But I'll let you know if I find out how
  13. Alright, this is what I have now.. It's not really doing anything though... Am I on the right track at least? <?php include("config.php"); $con=mysql_connect(localhost,$username,$password); @mysql_select_db(frontstep) or die( "Unable to select database"); $sql="SELECT clients.clientID,clients.clientName, workOrder.clientID FROM clients, workOrder WHERE clients.clientID = workOrder.clientID"; $result2 = mysql_query($sql); $sql="SELECT clients.clientID,clients.clientName, workOrder.clientID FROM clients INNER JOIN workOrder ON clients.clientID = workOrder.clientID WHERE workOrder.workOrderID = $workOrderID "; $result3 = mysql_query($sql); $row = mysql_fetch_array($result3); $selectedID = $row["clientID"]; // echo $selectedID; echos the correct ID, so I'm not sure why it's not doing anything.. while ($row=mysql_fetch_array($result2)) { $id=$row["clientID"]; $name=$row["clientName"]; $options.="<option value='$id'"; if($id == $selectedID)" SELECTED"; $options.= " >".$name."</option>"; } ?> <a><SELECT NAME=workOrderClient><?=$options?></SELECT></a>
  14. The problem is, "$_POST['workOrderClients']" doesn't seem have a value, as its not getting it from anywhere. I'm not sure if $_POST is the right thing to use. Also, correct me if I'm wrong, but shouldn't the 'if' have the {} tags? and shouldn't the last "$option" be "$options" aswell? As $option just screwed everything over I went ahead and replaced the $_POST with a straight ID number "159" (which is an existent client ID) and that should in theory select that certain client, right? But it just printed ' selected' right beside the dropdown menu, as if it's not inside the <option> tag.. and when I put a non existent ID number, it didn't print anything.
  15. Hello, I realize that I just joined your great site, but I have searched everywhere I could and just can't find a solution to this. Any help is appreciated I will try to make this as clear as I can! Basically I have a drop down menu, which is populated by MySQL columns, and that works great! Now, what I'm trying to accomplish is for people to be able to edit the forms the previously inputted (I got all the forms to work, including the radio buttons, I'm just stuck on this drop down). They have a list of all the clients they can edit, they click on the name of the client and they get sent to a page that displays the forms, with all the info in them. They get sent to: eg, "/workOrder.php?workOrderID=42" I have two SQL tables that I'm dealing with for this example, one is workOrder, and the other is clients. Inside the workOrder table we have a clientID column, which tells us which client has which workOrder (each client may have more than one work order). When they add a new work order, they have the dropdown with the list of all the clients names, and they pick the corresponding client. So when they go to edit, it needs select that client name from the drop down. I just have no idea how to go about this (I am a beginner programmer, so excuse me for any poor coding) Here's the code for the drop down that I have. <?php // connect to the DB $con=mysql_connect(localhost,username,password); @mysql_select_db(database) or die( "Unable to select database"); $sql="SELECT * FROM workOrder WHERE workOrderID = $workOrderID"; //this selects the work order row corresponding to the ID from "/workOrder.php?workOrderID=42" $result=mysql_query($sql); $sql="SELECT * FROM clients ORDER BY clientName ASC"; //and this selects the client names/ID, for the drop down menu $result2=mysql_query($sql); while ($row=mysql_fetch_array($result2)) { $id=$row["clientID"]; $name=$row["clientName"]; $options.="<OPTION VALUE=\"$id\">".$name.'</option>'; } ?> <SELECT NAME=workOrderClients><?=$options?></SELECT> I know I have to use the "selected" function for the <option> tag, but I'm unsure how to implement this, as I only have one <option> tag. Again, thanks for any help. I just don't really know where to even start :s
×
×
  • 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.