Jump to content

Kathy

Members
  • Posts

    28
  • Joined

  • Last visited

    Never

About Kathy

  • Birthday 09/04/1987

Profile Information

  • Gender
    Female
  • Location
    South Africa

Kathy's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi all! I am REALLY having trouble with this, I have made a drop down, populated it from a database table called categories and a field called Category, I would now like to populate another drop down from a database table called clients and a field called coName, based on the choice one makes in the categories drop down. I do not know how I would go about connecting the two drop downs? I have searched everywhere! Would appreciate any help! Thanks! Here is what I've done so far: $link = mysql_connect("host","link","pass"); mysql_select_db("dbname", $link); $query = "select Category FROM categories"; $results = mysql_query($query, $link) or die("Error performing query"); if(mysql_num_rows($results) > 0){ echo("<select name=\"Category\">"); while($row = mysql_fetch_object($results)){ echo("<option value=\"$row->record_id\">$row->Category</option>"); } echo("</select>"); }/code]
  2. Kathy

    drop down

    Okay, I've done the following: <? // Connect database $link = mysql_connect("host","login","pass"); mysql_select_db("dbname", $link); $query = "select Category FROM categories"; $results = mysql_query($query, $link) or die("Error performing query"); if(mysql_num_rows($results) > 0){ echo("<select name=\"Category\">"); while($row = mysql_fetch_object($results)){ echo("<option value=\"$row->record_id\">$row->Category</option>"); } echo("</select>"); } ?> I would now like to be able to populate another drop down based on the selection of the above drop down from a table called clients and a field name called coName, I'd appreciate ANY help, thanks!
  3. Kathy

    drop down

    Something is wrong with this piece of code here: <?PHP while (list($id, $coName) = mysql_fetch_array($result, MYSQL_NUM)) { echo("<option value=\"$id\">$coName</option>"); } echo('</select>'); } } else if (!empty($_POST['category'] && !empty($_POST['coName']))) { $cat = $_POST['category']; $subcat = $_POST['coName']; ..process.. } } ?> I've added another ) after ['coName'], but I'm still receiving this error when I run the script? Parse error: syntax error, unexpected T_BOOLEAN_AND, expecting ')'
  4. Kathy

    drop down

    Okay great, I've managed to populate my drop down: <?PHP $link = mysql_connect("host","login","pass"); mysql_select_db("dbname", $link); $query = "select Category FROM categories"; $results = mysql_query($query, $link) or die("Error performing query"); if(mysql_num_rows($results) > 0){ echo("<select name=\"Category\">"); while($row = mysql_fetch_object($results)){ echo("<option value=\"$row->record_id\">$row->Category</option>"); } echo("</select>"); } else{ echo("<i>No values found</i>"); }?> I now want to populate another drop down from a choice in this drop down using the WHERE query, can anyone offer me guidance?
  5. Kathy

    drop down

    I'm being a total newbie here, I've tried it like this, but it's obviously still wrong: <?PHP mysql_connect("dedi536.nur4.host-h.net","ivif09","ivifpa55")or die(mysql_error()); mysql_select_db("web_cat09")or die(mysql_error()); ?> getting the same mysql error I appreciate any help you can give me
  6. Just tried the following: INSERT INTO categories (Category) VALUES (‘Chemicals & Refining Agents’),(‘CIP Systems’),(‘Cleaning’),(‘Equipment & Services’) I get the following error: #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 'Agents’),(‘CIP Systems’),(‘Cleaning’),(‘Equipment & Services’)' at line 1 why is this?
  7. Here is my query: INSERT INTO categories (Category) VALUES ('Bottling Services'),('Brush Cutters'),('Building Construction/Supplies'),('Bulk Wine & Brandy Traders') Is this wrong? ???
  8. I'm veryvery used to PHP, but am wondering if it would be better to do this in Javascript? I'm trying to populate a drop down with a database table called categories and a field called Category, after selecting a category from this drop down, I'd like it to select another drop down from a table called clients and a field called CoName, after picking a company I'd like the company's contact details to be displayed in a way? Any suggestions?
  9. yes, that's what I'm trying to do, tried your suggestion, got the following error: #1062 - Duplicate entry '0' for key 1
  10. I'm trying to insert multiple values into one field in my table using the following statement: INSERT INTO table name (field) VALUES ('type','type','type',type') I'm getting the following error if I do this though: #1136 - Column count doesn't match value count at row 1 Can anybody give me some advice?
  11. Kathy

    drop down

    Is this right? function select_db(){ mysql_connect("localhost","login","pass")or die(mysql_error()); mysql_select_db("dbname")or die(mysql_error()); } $query = 'SELECT id, Category FROM categories'; $result = mysql_query($query, $db); if ($result) { $htmlSelect = '<select name="category-select">'; while (list($id, $category) = mysql_fetch_array($result, MYSQL_NUM)) { $htmlSelect .= "<option value=\"$id\">$category</option>"; } $htmlSelect .= '</select>'; }
  12. Kathy

    drop down

    Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource I get this when I run it The problem is over here : $result = mysql_query($query, $db); ?
  13. I need to populate a drop down box with a table named categories and a field called Category, how do I go about doing this?? ???
  14. Kathy

    PHP mail

    I'm currently using this code $to = 'person@domain.co.za'; $from = $email; $subject = 'Online Registration'; $message = '<body style="font-family:tahoma; font-size:12px; line-height:18px; color:#333366">'. $initials.', '.$surname.', '.$company_name.', '.$address.', '.$address2.', '.$address3.', '.$telephone.', '.$email.', '.$method.', '.$type.', '.$JobFunction. $Reference .'</body>'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'FROM: '. $from . "\r\n"; mail($to, $subject, $message, $headers); to send an email from a file to myself containing filled in information from a form, note that $JobFunction can be a choice of 13 checkboxes. See code below: if(isset($_POST["ch1"])){ $checkbox1 = $_POST["ch1"] . ", "; } if(isset($_POST["ch2"])){ $checkbox2 = $_POST["ch2"] . ", "; } if(isset($_POST["ch3"])){ $checkbox3 = $_POST["ch3"] . ", "; } if(isset($_POST["ch4"])){ $checkbox4 = $_POST["ch4"] . ", "; } if(isset($_POST["ch5"])){ $checkbox5 = $_POST["ch5"] . ", "; } if(isset($_POST["ch6"])){ $checkbox6 = $_POST["ch6"] . ", "; } if(isset($_POST["ch7"])){ $checkbox7 = $_POST["ch7"] . ", "; } if(isset($_POST["ch8"])){ $checkbox8 = $_POST["ch8"] . ", "; } if(isset($_POST["ch9"])){ $checkbox9 = $_POST["ch9"] . ", "; } if(isset($_POST["ch10"])){ $checkbox10 = $_POST["ch10"] . ", "; } if(isset($_POST["ch11"])){ $checkbox11 = $_POST["ch11"] . ", "; } if(isset($_POST["ch12"])){ $checkbox12 = $_POST["ch12"] . ", "; } if(isset($_POST["ch13"])){ $checkbox13 = $_POST["ch13"] . ", "; } $JobFunction = $checkbox1 . $checkbox2 . $checkbox3 . $checkbox4 . $checkbox5 . $checkbox6 . $checkbox7 . $checkbox8 . $checkbox9 . $checkbox10 . $checkbox11 . $checkbox12 . $checkbox13; I would like to change this to a 1 and 0 system, when somebody selects the checkbox it should display as 1, if not, it should display as 0, I cannot get this to work though and have tried to include my radio buttons into this system. $msgheading = "Visitor Registration from website"; $msg = $initials . ","; $msg .= $surname . ","; $msg .= $company . ","; $msg .= $postal . ","; $msg .= $city . ","; $msg .= $code . ","; $msg .= $tel . ","; $msg .= $email . ","; if ($business == 1) { $msg .= "1,0,0,0,"; } if ($business == 2) { $msg .= "0,1,0,0,"; } if ($business == 3) { $msg .= "0,0,1,0,"; } if ($business == 4) { $msg .= "0,0,0,1,"; } if ($owner <> '') { $msg .= "1,"; } else { $msg .= "0,"; } if ($finance <> '') { $msg .= "1,"; } else { $msg .= "0,"; } if ($human <> '') { $msg .= "1,"; } else { $msg .= "0,"; } if ($marketing <> '') { $msg .= "1,"; } else { $msg .= "0,"; } if ($farm <> '') { $msg .= "1,"; } else { $msg .= "0,"; } if ($research <> '') { $msg .= "1,"; } else { $msg .= "0,"; } if ($information <> '') { $msg .= "1,"; } else { $msg .= "0,"; } if ($vitic <> '') { $msg .= "1,"; } else { $msg .= "0,"; } if ($wine <> '') { $msg .= "1,"; } else { $msg .= "0,"; } if ($hospitality <> '') { $msg .= "1,"; } else { $msg .= "0,"; } if ($buying <> '') { $msg .= "1,"; } else { $msg .= "0,"; } if ($other <> '') { $msg .= "1"; } else { $msg .= "0"; } $sendto = "person@domain.co.za"; mail($sendto , $msgheading , $msg , "From: Website"); I can't get it to work though, any suggestions??
×
×
  • 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.