Jump to content

xox

Members
  • Posts

    44
  • Joined

  • Last visited

    Never

Everything posted by xox

  1. I'm writing php modul that has front-end(user) and back-end (admin) I can show you how it should look like in front-end http://imageshack.us/photo/my-images/214/screenhe.png/ Values bellow the select box are changing depending on option selected above. This entries can be unlimited. I know how to this but, my issue is how to make user friendly admin form. Admin must enter values in select box, size,price and also bolded text. Because this options aren't limited in no way I must make it so that admin can add fields - in short dynamic form. Any ideas?
  2. Well that's OK if you know how many input boxes you have, but I don't, that's the problem. My script is creating input boxes on the fly, depending on values in database (mysql). An example of my code for date input field <?php if($row['fieldtype'] == 'd') //d as date { $date++; ?> <input class="textFieldXXL" type="text" name="textboxRes[]"[b] id="datum<?php echo $date;?>"[/b] maxlength="50" value="" /> <img class="eFormsHelp" src="date.jpg" id="date<?php echo $count;?>" /> <LABEL class="inputDescription" FOR="desc"><?php echo $row['description'];?></LABEL> <div class="eFormsError"> <div id=divDatum<?php echo $date;?>> </div> </div> <?php } I've bolded where the problem is...
  3. Hello, I'm using date picker for my input boxes that needs date as input, everything works ok on an simple example like this css+js <style type="text/css"> @import "kolendar_stil.css"; </style> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> <script type="text/javascript" src="kolendar.js"></script> <script type="text/javascript"> $(function() { $('#popupDatepicker').datepick(); $('#inlineDatepicker').datepick({onSelect: showDate}); }); function showDate(date) { alert('The date chosen is ' + date); } </script> input (ISSUE only first textbox get's calender) <p>a <input type="text" id="popupDatepicker"></p> <p>b <input type="text" id="popupDatepicker"></p> <p>c <input type="text" id="popupDatepicker"></p> This was just an example, here is my code of what I'm trying <?php if($row['fieldtype'] == 'a') { $date++; ?> <style type="text/css"> @import "kolendar_stil.css"; </style> <script type="text/javascript"> $(function() { $('#date').datepick(); }); </script> <input class="textFieldXXL" type="text" name="textboxZamenjava[]" id="date<?php echo $date;?>" maxlength="50" value="" /> <img class="eFormsHelp" src="help.jpg" id="pomoc<?php echo $stej;?>" /> <LABEL class="inputDescription" FOR="desc"><?php echo $row['description'];?></LABEL> <div class="eFormsError"> <div id=divDate<?php echo $date;?>> </div> </div> But JS date picker won't show up, what' could be the issue? Here's the source of whole script, but I think there is no issue http://pastebin.com/RfgtkUzs
  4. Hello, I'm using phpmailer for this job, and what I want is that in first mail user gets only text and in second he gets text with attachment. But code below is only sending me the mail with attachment(second mail), what is cosing this problem? Here's the code for ($i=0; $i<2; $i++) { if (!class_exists("phpmailer")) { require("PHPMailer/class.phpmailer.php"); } if ($price != 0 ) { $mail = new PHPMailer(); $mail->CharSet = 'UTF-8'; $mail->From = "domain@d.com"; $mail->FromName = "Company"; $mail->AddAddress($email, ""); $mail->WordWrap = 50; $mail->IsHTML(true); $mail->Subject = "Subjcet"; $mail->Body = $content; } if ($i == 1 || $price == 0 ) { //require("PHPMailer/class.phpmailer.php"); $mail = new PHPMailer(); $mail->CharSet = 'UTF-8'; $mail->From = "domain@d.com"; $mail->FromName = "Company"; $mail->AddAddress($email, ""); $mail->WordWrap = 50; $mail->IsHTML(true); $mail->Subject = "Subjcet"; $mail->Addattachment ("file/patch".$fileName, ); // patch and name of an attachment } }
  5. Hello, I have a form that has a preview, before user can preview the form inputs he must login. If he is logedin, he can see preview and continue to editing form, but after user is finished with editing his values he is redirected to "preview" page for which he must be logged in. But the problem is that variables are "empty" after redirecting back to preview. $_POST['email'] is received from login.php $_SESSION['code'] is 5 digit code generated at start, it isn't important in this issue. Here's the code: preview.php $id_user= 0; $code = $_SESSION['code']; $email = $_POST['email']; $_SESSION['email_login'] = $email; So now you can see that $email and $_SESSION['email_login'] are empty because when redirecting from "editing" to preview $_POST['email'] can't be found...
  6. Problem remains, or should I say, things are even worse. Here's my processing script <style type="text/css"> <!-- div.media-box{ float:left; margin-right:40px; overflow: hidden; background-color:#CCCCFF; padding:3px; margin-bottom: 10px; border:1px solid #fff; color:#CC0000; } .media-box img{ background-repeat: repeat-x; background-position: center; margin:5px; } .clearrow{ clear:both; } --> </style> <div id="mediaboxes"> <?php $query = "SELECT DISTINCT k.ID, k.name_category, pk.name_subcategory, pk.id_subcategory FROM `categories` AS k LEFT JOIN `subcategories` AS pk ON pk.id_main_category = k.ID"; $result = mysql_query($query) or die(mysql_error()); $currentCat = false; while($row = mysql_fetch_array($result)) { if($currentCat != $row['ID']) { $i++; if ($i==4 || $i==8 || $i==12 || $i==16) { ?> <div class="clearrow"></div> <?php } ?> <div class="media-box"> <img src="http://i55.tinypic.com/2d962ww.png" alt="" /> <br /> <b><?php echo $row['name_category'] ?></b> <?php $currentCat= $row['ID']; } ?> </div> </div> <div id="extra-box"> <p> <a href="?action=xxx&id=<?php print $row['id_subcategory'];;?>"><?php print $row['name_subcategory'] ?></a></p> <input type="button" value="Back" onClick="history.go(-1);return true;"> </div> <?php } ?> And here is output generated by above script <!-- START: Content --> <div class="contentContainer clearfix"> <div class="wideMainContent"> <div class="article"> <h6 class="font"> E-obrazci</h6> <style type="text/css"> <!-- div.media-box{ float:left; margin-right:40px; overflow: hidden; background-color:#CCCCFF; padding:3px; margin-bottom: 10px; border:1px solid #fff; color:#CC0000; } .media-box img{ background-repeat: repeat-x; background-position: center; margin:5px; } .clearrow{ clear:both; } --> </style> <div id="mediaboxes"> <div class="media-box"> <img src="http://i55.tinypic.com/2d962ww.png" alt="" /> <br /> <b>Test text</b> </div> </div> <div id="extra-box"> <p> <a href="?action=xxx&id=95">Text bottom</a></p> <input type="button" value="Back" onClick="history.go(-1);return true;"> </div> <div class="media-box"> <img src="http://i55.tinypic.com/2d962ww.png" alt="" /> <br /> <b>Test text</b> </div> </div> <div id="extra-box"> <p> <a href="?action=xxx&id=99">Bottom text</a></p> <input type="button" value="Back" onClick="history.go(-1);return true;"> </div> <div class="media-box"> <img src="http://i55.tinypic.com/2d962ww.png" alt="" /> <br /> <b>Izvršba</b> </div> </div> <div id="extra-box"> <p> <a href="?action=xxx&id=96">bottom text</a></p> <input type="button" value="Back" onClick="history.go(-1);return true;"> </div> <div class="clearrow"></div> <div class="media-box"> <img src="http://i55.tinypic.com/2d962ww.png" alt="" /> <br /> <b>Test text/b> </div> </div> <div id="extra-box"> <p> <a href="?action=xxx&id=100">Bottom text</a></p> <input type="button" value="Back" onClick="history.go(-1);return true;"> </div> </div> </div> <div id="extra-box"> <p> <a href="?action=xxx&id=103">Bottom text</a></p> <input type="button" value="Back" onClick="history.go(-1);return true;"> </div> <div class="media-box"> <img src="http://i55.tinypic.com/2d962ww.png" alt="" /> <br /> <b>Test text</b> </div> </div> <div id="extra-box"> <p> <a href="?action=xxx&id=105">bottom text</a></p> <input type="button" value="Back" onClick="history.go(-1);return true;"> </div> <div class="media-box"> <img src="http://i55.tinypic.com/2d962ww.png" alt="" /> <br /> <b>Test text</b> </div> </div> <div id="extra-box"> <p> <a href="?action=xxx&id=101">Bottom text</a></p> <input type="button" value="Back" onClick="history.go(-1);return true;"> </div> </div> </div> <div id="extra-box"> <p> <a href="?action=xxx&id=102">Bottom text</a></p> <input type="button" value="Back" onClick="history.go(-1);return true;"> </div> </div> </div>
  7. The problem I'm getting now is that div is closed to early when more than one line is written. Can you help me out with it? Here's the source: <div class="media-box"> <img src="http://i55.tinypic.com/2d962ww.png" alt="" /> <br /> <b>Test text</b> <p> <a href="?action=xxx&id=100">Text bottom</a> </p> </div><!-- here's the problem --> <p> <a href="?action=xxx&id=103">Text bottom</a> </p> </div> Your blog is already in my favorites.
  8. I've misunderstood you, sorry. Here's the source <!-- START: Content --> <div class="contentContainer clearfix"> <div class="wideMainContent"> <div class="article"> <h6 class="font"> Testing</h6> <style> <!-- div.media-box{ float:left; margin-right:40px; overflow: hidden; background-color:#CCCCFF; padding:3px; margin-bottom: 10px; border:1px solid #fff; color:#CC0000; } .media-box img{ background-repeat: repeat-x; background-position: center; margin:5px; } --> </style> <div class="media-box"> <img src="http://i55.tinypic.com/2d962ww.png" alt="" /> <br /><b>Test text</b> <p><a href="?action=xxx&id=95">Text bottom</a> </p> </div> <div class="media-box"> <img src="http://i55.tinypic.com/2d962ww.png" alt="" /> <br /><b>Test text</b> <p><a href="?action=xxx&id=99">Text bottom</a> </p> </div> <div class="media-box"> <img src="http://i55.tinypic.com/2d962ww.png" alt="" /> <br /><b>Test text</b> <p><a href="?action=xxx&id=96">Text bottom</a> </p> </div> <div class="media-box"> <img src="http://i55.tinypic.com/2d962ww.png" alt="" /> <br /><b>Test text</b> <p><a href="?action=xxx&id=100">Text bottom</a> </p> </div> <p><a href="?action=xxx&id=103">Text bottom</a> </p> </div> <div class="media-box"> <img src="http://i55.tinypic.com/2d962ww.png" alt="" /> <br /><b>Test text</b> <p><a href="?action=xxx&id=105">Text bottom</a> </p> </div> <div class="media-box"> <img src="http://i55.tinypic.com/2d962ww.png" alt="" /> <br /><b>Test text</b> <p><a href="?action=xxx&id=101">Text bottom</a> </p> </div> <p><a href="?action=xxx&id=102">Text bottom</a> </p> </div> <input type="button" value="Back" onClick="history.go(-1);return true;">  </div> </div>
  9. This is the whole code I've written <style> <!-- div.media-box{ float:left; margin-right:40px; overflow: hidden; background-color:#CCCCFF; padding:3px; margin-bottom: 10px; border:1px solid #fff; color:#CC0000; } .media-box img{ background-repeat: repeat-x; background-position: center; margin:5px; } --> </style> <?php $query = "SELECT DISTINCT k.ID, k.name_category, pk.name_subcategory, pk.id_subcategory FROM `categories` AS k LEFT JOIN `subcategories` AS pk ON pk.id_main_category = k.ID"; $result = mysql_query($query) or die(mysql_error()); $currentCat = false; while($row = mysql_fetch_array($result)) { //so it doesn't repeat if($currentCat != $row['ID']) { ?> <div class="media-box"> <img src="http://i55.tinypic.com/2d962ww.png" alt="" /> //main category output <br /><b><?php echo $row['name_category']?></b> <?php $currentCat = $row['ID']; } //subcategory output ?> <p><a href="?action=xxxx&id=<?php print $row['id_subcategory'];?>"><?php print $row['name_subcategory'] ?></a> </p> </div> <? } ?> Well I know how to make image as background in CSS but is this possible inside .media-box img class? Because I will get images from mysql with something like this <img src="images/'.$row['path']." alt="" /> and I believe php inside css isn't possible.
  10. Thanks for you help, this is what I was looking for! But now I have a slight problem with more than one line of text under the image,you can see in screen shot that text is on the right side... totally wrong place. The problem is also that the last two boxes doesn't have links like others have and "test text" isn't bold. Also how could I make image as background with this solution you've posted? The image with the problem described is attached to this post. CSS div.media-box{ float:left; margin-right:40px; overflow: hidden; background-color:#CCCCFF; padding:3px; margin-bottom: 10px; border:1px solid #fff; color:#CC0000; } .media-box img{ background-repeat: repeat-x; background-position: center; margin:5px; } HTML/PHP <?php $query = "SELECT DISTINCT k.ID, k.name_category, pk.name_subcategory, pk.id_subcategory FROM `categories` AS k LEFT JOIN `subcategories` AS pk ON pk.id_main_category = k.ID"; $result = mysql_query($query) or die(mysql_error()); $currentCat = false; while($row = mysql_fetch_array($result)) { //so it doesn't repeat if($currentCat != $row['ID']) { ?> <div class="media-box"> <img src="http://i55.tinypic.com/2d962ww.png" alt="" /> <br /><b>{$row['name_category']}</b> <?php $currentCat = $row['ID']; } ?> <p><a href="?action=xxx<?php print $row['id_subcategory'];?>"><?php print $row['name_subcategory'] ?></a></p> </div> <? } ?> [attachment deleted by admin]
  11. I wonder how image galleries work... they show everything in grid...
  12. Hello, at the moment I'm displaying categories and subcategories in tree -category --subcategory -category2 --subcategory2 etc. I would like to display them in grid (3x4 - I have 12 categories) using divs The code for tree is <?php $query = "SELECT DISTINCT k.ID, k.name_category, pk.name_subcategory, pk.id_subcategory FROM `categories` AS k LEFT JOIN `subcategories` AS pk ON pk.id_main_category = k.ID"; $result = mysql_query($query) or die(mysql_error()); $currentCat = false; while($row = mysql_fetch_array($result)) { //so it doesn't repeat if($currentCat != $row['ID']) { echo "<br /><b>{$row['name_category']}</b>\n"; $currentCat = $row['ID']; } / ?> <br/><a href="?action=xxx<?php print $row['id_subcategory'];?>"><?php print $row['name_subcategory'] ?><br /></a> <br /> <? } ?> It should be something like this, but I will make images appear behind the text not on the side
  13. Ok, made few changes, but site just reloads and values aren't update... any idea? <?php if(isset($_POST["posodobi"])) { for($i=0;$i<sizeof($_POST["id"]);$i++) { echo"UPDATE podkategorije SET ime_podkategorije = '".$_POST['podkategorije'][$i]."' WHERE id_podkategorij=".$_POST['trenutnaPodkategorija'][$i].";" or die(mysql_error()); $shrani ="UPDATE podkategorije SET ime_podkategorije = '".$_POST['podkategorije'][$i]."' WHERE id_podkategorij=".$_POST['trenutnaPodkategorija'][$i].";" or die(mysql_error()); mysql_query($shrani); echo "UPDATE kategorije SET ime_kategorije = '".$_POST['kategorije'][$i]."' WHERE ID=".$_POST['trenutnaKat'][$i].";" or die(mysql_error()); $shraniKat="UPDATE kategorije SET ime_kategorije = '".$_POST['kategorije'][$i]."' WHERE ID=".$_POST['trenutnaKat'][$i].";" or die(mysql_error()); mysql_query($shraniKat); } } ?> <form action="" method="post" > <?php //preimenovanje kategorij/podkategorij $query = "SELECT k.ID, k.ime_kategorije, pk.ime_podkategorije, pk.id_podkategorij FROM `kategorije` AS k JOIN `podkategorije` AS pk ON pk.id_glavne_kategorije = k.ID"; $result = mysql_query($query) or die(mysql_error()); $trenutnaKat = false; while($row = mysql_fetch_array($result)) { $stevec++; //da se ne ponavlja if($trenutnaKat != $row['ID']) { //izpis glavne kategorije ?> <ul> <li> <br/><input name="kategorije" type="text" value="<?php echo $row['ime_kategorije']; ?>" /> </li> </ul> <? $trenutnaKat = $row['ID']; } //izpis podkategorije ?> <input name="podkategorije" type="text" value="<?php echo $row['ime_podkategorije']; ?>" /><br/> <input type="hidden" name="trenutnaKat" value="<?php echo $row['ID']; ?>" /> <input type="hidden" name="trenutnaPodkategorija" value="<?php echo $row['id_podkategorij']; ?>" /> <? } echo '<input type="hidden" name="id[]" value="'.$stevec.'">'; ?> <br /> <input type="button" value="Nazaj" onClick="history.go(-1);return true;"> <input type="submit" value="Posodobi" name="posodobi"/> </form>
  14. I have problem that only last text field is updated, how should I fix this? Here's the code <?php if(isset($_POST["update"])){ mysql_query("UPDATE categories SET name_category = '".$_POST['category']."' WHERE ID= ".$_POST['currentCat']." ") or die(mysql_error()); mysql_query("UPDATE podkategorije SET name_subcategory = '".$_POST['subcategory']."' WHERE id_subCat= ".$_POST['currentSubCat']." ") or die(mysql_error()); } ?> <form action="" method="post" > <?php //creating texfields from db $query = "SELECT k.ID, k.name_category, pk.name_subcategory, pk.id_subCat FROM `categories` AS k JOIN `subcategories` AS pk ON pk.id_mainCat = k.ID"; $result = mysql_query($query) or die(mysql_error()); $currentCat = false; while($row = mysql_fetch_array($result)) { //so it doesn't repeat itself if($currentCat != $row['ID']) { //display of main Categories ?> <ul> <li> <br/><input name="categories" type="text" value="<?php echo $row['name_category']; ?>" /> </li> </ul> <? $currentCat = $row['ID']; } //display subcategories ?> <input name="subcategories" type="text" value="<?php echo $row['name_category']; ?>" /><br/> <input type="hidden" name="currentCat" value="<?php echo $row['ID']; ?>" /> <input type="hidden" name="currentSubCat" value="<?php echo $row['id_subCat']; ?>" /> <? } ?> <br /> <input type="button" value="Back" onClick="history.go(-1);return true;"> <input type="submit" value="Update" name="update"/> </form>
  15. Knocking my head for 4 hours today on this bug and still didn't find proper solution.
  16. Well I know that but it's the only way for now because PDF files will have limited "life time". Still trying to found out the 0bytes size solution :\
  17. I would like to store PDF file into mysql (this part works) and then send it as email attachment and it should be retrieved from mysql table. Here's the code I have for now, but what it gives me is 0bytes large PDF file Saving PDF to mysql (it works), because size of blob in mysql table is OK. $fp = fopen('generated.pdf', 'r'); $content = fread($fp,filesize('generated.pdf')); $content = addslashes($content); fclose($fp); $DB->Query('insert into pdf_files (pdf_file, name) values ("'.$content.'", "'.$name.'")'); And here's the mailing part <?php $query = "SELECT name, pdf_file FROM pdf_files $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array ( $result)) { $fileContent =$row['pdf_file']; $fileName=$row['name']; } $fileatt = $fileContent; // getting file $fileatt_type ="application/pdf"; //type of file $fileatt_name = "attachment.pdf"; // name $fileatt_size = $fileSize; $email_from = "dont@have.it"; // mail from $email_subject = "Testtt"; // subject $email_message = "Testtt.<br>"; $email_message .= "Testtt.<br>"; // Message $email_to = $mail_user; // users mail $headers = "From: ".$email_from; $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; $email_message .= "Testtt.\n\n" . "--{$mime_boundary}\n" . "Content-Type:text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $email_message .= "\n\n"; $data = chunk_split(base64_encode($data)); $email_message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data .= "\n\n" . "--{$mime_boundary}--\n"; $ok = @mail($email_to, $email_subject, $email_message, $headers); if($ok) { echo "<font face=verdana size=2><center>Mail was sent</center>"; } else { die("Error!"); } ?>
  18. Thanks for point me to JOINS, I'll get reading right away. You helped me a lot!
  19. I have two tables categories and subcategories and what I want do is display them but here I ran into problem displaying the subcategories. Here's the code that doesn't work, all it does it displays categories. $query = "SELECT ID,name FROM `categores`"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)) { echo $row['name']; $id_main=$row['ID']; $query2 ="SELECT name_subcategory FROM subcategories WHERE id_main_category=".$row['ID']; $result2 = mysql_query($query2) or die(mysql_error()); while ($row2=mysql_fetch_array($result2)); { echo $row2['name_subcategory']; } echo "<br />"; } Display should be -category --subcategory --subcategory -another category --subcategory of "another category" . . .
  20. Thank you, all errors are gone. The only problem is that now all main categories have the same subcategories
×
×
  • 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.