Jump to content

Hrvoje

Members
  • Posts

    45
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    Croatia

Hrvoje's Achievements

Member

Member (2/5)

0

Reputation

  1. How to define that two classes in php and echo it. How to integrate it: ex... $color1="#000000"; $color2="#FFFFFF";
  2. This is code that show that records: <?PHP include("config.php"); $sql="SELECT * FROM stanje_lijekova ORDER BY naziv_lijeka ASC"; if (!$q=mysql_query($sql)) { echo "Error" . mysql_query(); die(); } if (mysql_num_rows($q)==0) { echo "No data!"; } else { while ($redak=mysql_fetch_array($q)) { echo " <div class='podatak'> <div class='naziv_lijeka_p'><p class='polje_tekst'> ".$redak['naziv_lijeka']."</p></div> <div class='sifra_p'><p class='polje_tekst'> ".$redak['sifra']."</p></div> <div class='jed_mjera_p'><p class='polje_tekst'> ".$redak['mjera']."</p></div> <div class='kolicina_p'><p class='polje_tekst'> ".$redak['kolicina']."</p></div> <div class='ostalo_p'><p class='polje_tekst'></p></div> </div>"; }}; ?> I apologise for wrong code upper.
  3. Ok, I understand this. Thanks I know how to select all rows with value '0'. But how to echo ex... color1 for records that have 0 in field kolicina?
  4. My mistake with mysql_num_rows. If there is any 0 in any field I want to echo diferent color to div class. Like in last picture.
  5. Hello, need some help. I have this code to see if there is any 0 number in field. <?PHP $boja1="divclass1"; $boja2="divclass2"; $provjera="SELECT kolicina FROM stanje_lijekova WHERE kolicina= 0"; if (!$q=mysql_query($provjera)) { echo "Error" . mysql_query(); die(); } if (mysql_num_rows($q)>0) { $boja1; } else { $boja2; } ?> How can I make this code to echo one of two variables with div class. If row have number 0 in field than my class need divclass1 if any other number than is divclass2. <div class='here i need that echo'>some code</div> And my dba: This is classic mouse hover css:
  6. Is this is a joke? I do not want to be misunderstood. I apologize if you don't understand me. There are no errors in SQL
  7. Thanks for your reply. QuickOldCar - Your code is working. And csootstah, your code only upload images but nothing inserts in dba. Here is pharse error, I correct it but nothing happend. Only upload images. $insertValues[] = "('" . $kategorija . "', '" . $url . "'"); $insertValues[] = "('" . $kategorija . "', '" . $url . "')";
  8. Hi there, I need a little help... I have simple form/code for upload image and insert it into db, and its working. <form name="unos" action="" method="post" enctype="multipart/form-data"> <select name="kategorija"> <option value="1">Album</option> </select> <input type="file" name="uploaded_file[]" id="file" > </form> <?PHP include "config.php"; $uploads_dir = 'slike'; foreach ($_FILES["uploaded_file"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK) { $tmp_name = $_FILES["uploaded_file"]["tmp_name"][$key]; $name = $_FILES["uploaded_file"]["name"][$key]; move_uploaded_file($tmp_name, "$uploads_dir/$name"); } } $sql="INSERT INTO galerija_slike (kategorija_id, url_slike) VALUES ('".$_POST['kategorija']."', '".$_FILES['uploaded_file']['name'][$key]."')"; if (mysql_query($sql)) { echo "success"; } else { echo "error" . mysql_error(); } ?> How can I store more image url's from input fields? When I add more input fields..... move_uploaded_file(): uploads all images, but I don't know how to also add them in db? I need something like this: <input type="file" name="uploaded_file[]" id="file" > <input type="file" name="uploaded_file[]" id="file" > <input type="file" name="uploaded_file[]" id="file" > <input type="file" name="uploaded_file[]" id="file" > <input type="file" name="uploaded_file[]" id="file" > Thanks
  9. Hi there, I have simple code with echo link on external page. <?PHP $sql="SELECT * FROM links WHERE link='external'"; if (!$q=mysql_query($sql)) { echo "Error" . mysql_query(); die(); } if (mysql_num_rows($q)==0) { echo "No data"; } else { while ($row=mysql_fetch_array($q)) { ?> <a href="<?PHP echo $row["link"];?>"><?PHP echo $row["link"];?></a> <?PHP } } ?> In database I have field clicks, how to increase that field on every click for 1. Thanks, Hrvoje
  10. Thanks to all... I solved my problem: include "connect.php"; $sql="SELECT email FROM emailuser WHERE id=1"; $result = mysql_query($sql); while ($row=mysql_fetch_array($result)) { ... } $to = $row['email']; mail($to, ....); Best regards Hrvoje
  11. I want to send email trough this script, I need to select only one mail adress from table, and than send it to that mail adres. It will be only one email address in that table. Value of the field email will change ex.. every two days but always with ID 1 $sql="SELECT * FROM emailtable WHERE id =1";
  12. This would be the original: <?PHP $error = ''; // error message $name = ''; // sender's name $email = ''; // sender's email address $subject = ''; // subject $message = ''; // the message itself $spamcheck = ''; // Spam check if(isset($_POST['send'])) { $name = $_POST['name']; $email = $_POST['email']; $subject = $_POST['subject']; $message = $_POST['message']; $spamcheck = $_POST['spamcheck']; if(trim($name) == '') { $error = '<div class="errormsg">Molimo unesite Vaše Ime!</div>'; } else if(trim($email) == '') { $error = '<div class="errormsg">Molimo unesite Vašu email adresu!</div>'; } else if(!isEmail($email)) { $error = '<div class="errormsg">Unjeli ste krivu Email adresu!</div>'; } if(trim($subject) == '') { $error = '<div class="errormsg">Molimo unesite naslov poruke!</div>'; } else if(trim($message) == '') { $error = '<div class="errormsg">Molimo unesite poruku!</div>'; } else if(trim($spamcheck) == '') { $error = '<div class="errormsg">Molimo unesite broj provjere!</div>'; } else if(trim($spamcheck) != '5') { $error = '<div class="errormsg">Provjera: Broj je netoèan! 2 + 3 = ???</div>'; } if($error == '') { if(get_magic_quotes_gpc()) { $message = stripslashes($message); } $to = "mail-test@mail-test.com"; $subject = 'Contact email : ' . $subject; $msg = "Od : $name \r\nE-mail : $email \r\nSubject : $subject \r\n\n" . "Poruka : \r\n$message"; mail($to, $subject, $msg, "Od: $email\r\nReply-To: $email\r\nReturn-Path: $email\r\n"); ?> <p>Thanks <b><?PHP echo $name;?></b></p> <p>Success</p> <?PHP } } if(!isset($_POST['send']) || $error != '') { ?> <?PHP echo $error;?> <form method="post" name="contFrm" id="contFrm" action=""> <label><span class="required">*</span> Ime i Prezime:</label> <input name="name" type="text" class="box" id="name" size="40" value="<?PHP echo $name;?>" /> <label><span class="required">*</span> E-mail: </label> <input name="email" type="text" class="box" id="email" size="40" value="<?PHP echo $email;?>" /> <label><span class="required">*</span> Naslov: </label> <input name="subject" type="text" class="box" id="subject" size="40" value="<?PHP echo $subject;?>" /> <label><span class="required">*</span> Poruka: </label> <textarea name="message" cols="37" rows="10" id="message"><?PHP echo $message;?></textarea> <label><span class="required">*</span> Provjera: <b>2 + 3=</b></label> <input name="spamcheck" type="text" class="box" id="spamcheck" size="4" value="<?PHP echo $spamcheck;?>" /> <input name="send" type="submit" class="button" id="send" value="" /> </form> <?PHP } function isEmail($email) { return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i" ,$email)); } ?> Now I want to send mail with that, but how to select email adress from database like this method: include "connect.php"; $sql="SELECT * FROM emailadress"; while ($row=mysql_fetch_array($sql)) { } I have only one record in that table (one email adress)
  13. Ok, thanks. So this is the code: <?PHP $error = ''; // error message $name = ''; // sender's name $email = ''; // sender's email address $subject = ''; // subject $message = ''; // the message itself $spamcheck = ''; // Spam check if(isset($_POST['send'])) { $name = $_POST['name']; $email = $_POST['email']; $subject = $_POST['subject']; $message = $_POST['message']; $spamcheck = $_POST['spamcheck']; if(trim($name) == '') { $error = '<div class="errormsg">Molimo unesite Vaše Ime!</div>'; } else if(trim($email) == '') { $error = '<div class="errormsg">Molimo unesite Vašu email adresu!</div>'; } else if(!isEmail($email)) { $error = '<div class="errormsg">Unjeli ste krivu Email adresu!</div>'; } if(trim($subject) == '') { $error = '<div class="errormsg">Molimo unesite naslov poruke!</div>'; } else if(trim($message) == '') { $error = '<div class="errormsg">Molimo unesite poruku!</div>'; } else if(trim($spamcheck) == '') { $error = '<div class="errormsg">Molimo unesite broj provjere!</div>'; } else if(trim($spamcheck) != '5') { $error = '<div class="errormsg">Provjera: Broj je netoèan! 2 + 3 = ???</div>'; } if($error == '') { if(get_magic_quotes_gpc()) { $message = stripslashes($message); } $subject = 'Contact email : ' . $subject; $msg = "Od : $name \r\nE-mail : $email \r\nSubject : $subject \r\n\n" . "Poruka : \r\n$message"; include "connect.php"; $sql="SELECT * FROM emailadress"; while ($row=mysql_fetch_array($sql)) { } $to = $row['email']; die('$to is set to -'.$to.'-'); mail($to, $subject, $msg, "Od: $email\r\nReply-To: $email\r\nReturn-Path: $email\r\n"); ?> <p>Thanks <b><?PHP echo $name;?></b></p> <p>Success</p> <?PHP } } if(!isset($_POST['send']) || $error != '') { ?> <?PHP echo $error;?> <form method="post" name="contFrm" id="contFrm" action=""> <label><span class="required">*</span> Ime i Prezime:</label> <input name="name" type="text" class="box" id="name" size="40" value="<?PHP echo $name;?>" /> <label><span class="required">*</span> E-mail: </label> <input name="email" type="text" class="box" id="email" size="40" value="<?PHP echo $email;?>" /> <label><span class="required">*</span> Naslov: </label> <input name="subject" type="text" class="box" id="subject" size="40" value="<?PHP echo $subject;?>" /> <label><span class="required">*</span> Poruka: </label> <textarea name="message" cols="37" rows="10" id="message"><?PHP echo $message;?></textarea> <label><span class="required">*</span> Provjera: <b>2 + 3=</b></label> <input name="spamcheck" type="text" class="box" id="spamcheck" size="4" value="<?PHP echo $spamcheck;?>" /> <input name="send" type="submit" class="button" id="send" value="" /> </form> <?PHP } function isEmail($email) { return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i" ,$email)); } ?>
×
×
  • 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.