Jump to content

jake2891

Members
  • Posts

    113
  • Joined

  • Last visited

    Never

Everything posted by jake2891

  1. Okay thanks for all your input and help guys. I will go with the session solution
  2. yeah i was thinking thats a possibility but i dont think its the best solution i was hoping to find a proper way of doing it thanks though
  3. Basically $emails variable gets its value from calling a php function that pulls email addresses from a database and apends each email in an array by a ; the other popup form is a form containing a message textarea and a cc and bcc input fields. the form also has a send button which sends the email. the to field gets its value from the posting of the array of emails that i need to somehow get to that new popup form.
  4. Hi Guys, This is a php related question but i will be showing a little javascript to get my point across. Basically i have a php form that has a variable that holds an array of email addresses. My problem is I have a link thats calls a javascript function to open a php page in a popup window. My problem is how do i go about posting the php variable containing the emails to the new php popup page if the link is a javascript link? I need it to be post because as passing it through a url wont work due to character limit. Any help would be greatly appreciated and if this post is in the wrong forum i do apologise. for example $test = '<a href onClick="myPopup">Open new form</a>'; then that calls the function myPopup which opens for example test.php. So now i need to pass $emails to this new form via POST from the previous form holding the href link?
  5. thanks for your reply. Although im passing the value 3 via the url. So would there be another way of doing it mathematically besides the following way below? eg '/1\+2=3/' instead of '/3/' if(preg_match('/3/',$this->getRequest()->getParameter('test'))) // test holds the value 3 { $this->test = "your paramater matches."; echo $test; }
  6. Hi guys, Can anyone see why my preg_match equation is not matching? basically trying to work out how equations work in regular expressions <?php if(preg_match('/1\+2=3/',3)) { $this->test = "your paramater matches."; echo $test; } ?>
  7. Hi guys, I have a form that im submitting and storing the data. What im having difficulty with is a label that I need displaying. if the date has been entered between 12.00 am and 15:59 pm then the label will be shown "new client" anything entered after 16:00 pm to 23.59pm the label wont be displayed today but should be displayed tomorrow instead. example code below. when i do the insert im using php's time() function for the date_added <?php $sql = "SELECT * FROM requirements"; $query = mysql_query($sql); $array = mysql_fetch_array($query); foreach($array as $a){ // something like // if $a['date_added'] put in today before 4pm display label else tomorrow it should display $label = 'New client'; } ?>
  8. Basically if your storing an image in a directory you need to search that directory for the image path then put it into the email script. But for the image to be displayed by the recipient you need to give it an absolute path for example. '<img src="http://'.$_SERVER['HTTP_HOST'].'/'.$image_path.'" />'; let me know if ur still stuck
  9. Hi Guys Im using a wysiwyg rich text editor in my php page to change a textarea into a htmlarea. The problem is when I post the area it contains nothing everytime and I have tried with a few different versions so its not the editor is there some php configuration I need to make in order to get the post? Made a simple test page below with some sample code. as when i do a $_POST['mytextarea3'] as a plain textarea the php receives it fine. I hope this is the rite forum for posting this if not I do apologise as I feel this is a php related issue not with the actual library. <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <script language="JavaScript" type="text/javascript" src="/wysiwyg_beta/wysiwyg.js"></script> <script> function validate() { document.example.action="test.php"; document.example.submit(); } </script> </head> <body > <form name="example" method="POST" > <textarea id="mytextarea" name="mytextarea3" style="height: 200px; width: 500px;"> </textarea> <script language="javascript1.2"> generate_wysiwyg('mytextarea'); </script> <input type="button" id="button" value="postme" onclick="validate()"/> </form> </body> </html> <?php echo 'Debug 1:<br />'; echo '<pre>'; print_r($_POST['mytextarea3']); echo '</pre>'; ?>
  10. changing the $row['field_name'] to $r['field_name'] etc..
  11. since you already have the $row in the above section of the code try this instead foreach($row as $r) { echo "<li><a href='editjobs.php?=" .$row['job_id']. "' >" .$row['job_number']. "</a>, " .$row['job_desc']. "</li>"; }
  12. Also the $career shudn't be in single quotes or else it will be read as a string and not its value. rather try '.$career.'
  13. $sql = "Select * From items where career = '$career'"; if($min_lvl != ''){ $sql .= " and min_level >= $min_lvl"; } if($max_lvl != ''){ $sql .= "and max_level <= $max_lvl"; }
  14. Not 100% sure what you want but. If im thinking correctly yes that can be done very easily. <?php $var = "Hi"; ?> <html> head, body etc goes there too. <table><tr><td><?php echo $var; ?></td></tr></table> </html> Is that what you were after?
  15. Hey Guys, Im trying to apply a custom true type font to my text below but cant seem to get it working. Any help will be a great thanks. <style type="text/css"> @font-face { font-family:myfont; src: url("font.ttf"); } .myclass { font-face:myfont; } </style> <td class="myclass">TEXT TO USE FONT</td> Ive also tried this with the @import to. maybe im using the incorrect syntax?
  16. Thanks for your help will give it a try Hopefully it solves my problem.
  17. Hi Guys, Can anyone help me figure out how to get a specific result please. Basically i have a table containing property id's. I need to work out which property id appears in the table the most and count this. example table below // notice 3 property ids are the same user_id property_id 1 1 2 1 3 1 4 2 5 3 So property id 1 appears the most, so i need to count all the property ids, determine out which one has the most of the same property ids and then total how many property ids the one that appears the most has. eg 3 I was thinking 'SELECT count(*) from foo AS tot GROUP BY property_id'; then selecting MAX but abit lost.
  18. All this line means is that if admin ==1 then use roll admin else use role_registered its the same as if(admin==1){ roleadmin }else{ role_registered } does that help? $this->role = ($this->admin == 1)? ROLE_ADMIN : ROLE_REGISTERED;
  19. Hi guys, thanks for taking the time to read my post. Im having a little difficulty with my code, ive made comments in the code where my problems are and what the problem is. Any input would be greatly appreciated. But basically its a php script that uses a pdf library that generates pdf's from html. 2 problems in my code below. /** uses the pdf library The below code gets location ids calls a function that gets the property information with the location id puts the information into html then spits it back which generates a pdf document. */ $html = ''; if($_REQUEST['locationIDs'] != '') { $locationIDs = explode("~",$_REQUEST['locationIDs']); $img_urls = array(); foreach($locationIDs as $value){ /* calls the function which gets the html */ /* lists the html and image path returned from the buffer in the draw_property_summary function */ list($p_html, $img_path) = draw_property_summary($value,$propertySearchDepartment); $img_urls[] = $img_path; $html .= $p_html; } /** Rite heres problem no 1, the below code should delete the image saved in the draw_property_summary function now we have the image in the html, see function. But it doesnt. */ foreach($img_urls as $img_url){ if($img_url){ if(!is_dir($img_url)){ // been through the checks and its not a directory and the image is there unlink($img_url); //something faulty here? } } } $old_limit = ini_set("memory_limit", "16M"); $dompdf = new DOMPDF(); $dompdf->load_html($html); /* reads the html */ $dompdf->set_paper('letter', 'portrait'); $dompdf->render(); $dompdf->stream("dompdf_out.pdf"); exit(0); } function draw_property_summary($propertyID,$department){ ob_start(); global $SearchApiUrl; $param='?hash='.$propertyID; $result=''; $data=''; /* just gets property information */ $viart_xml = fopen($SearchApiUrl.$param, "r"); if($viart_xml) { while (!feof($viart_xml)) { $result.= fread($viart_xml, 1024); } } if($result) { $data = unserialize($result); foreach ($data as $row) { $address_line = join_nonempty(", ", array($row['address1'], '<br>'.$row['address2'])); $img_url = $row['image_url']; $description = $row['description']; $department == 'sales' ? $price = $row['price_numeric'] : $row['rent_numeric']; $tenure = $row['tenure']; } } $handle = fopen($img_url, "r"); $source = ''; while (!feof($handle)) { $source .= fgets($handle); } /* Here i change the name of the image i got and save it to a temp directory Problem No2, after i rename the image and save it that works fine but the image in the pdf generated comes out tiny i dont know why because when i view the image in the browser its a normal size, tried changing the width and height in the html below but it stil remains tiny?? */ file_put_contents('../images/tmp/'.$propertyID.'.jpg',$source); fclose($handle); $img_url = 'http://'.$_SERVER['SERVER_NAME'].'/images/tmp/'.$propertyID.'.jpg'; ?> <table> <tr> <td style="border-bottom: 1px solid rgb(0, 0, 0);" valign="top" width="260"> <?php if($img_url) { ?><img src="<?php echo $img_url; ?>" width="250" height="175"><?php } ?> </td> </tr> </table> <?php $buffer = ob_get_contents(); ob_end_clean(); /* returns the html and the image url */ return array($buffer, $img_url); } Please use CODE tags when posting code
  20. Hi guys i have a pdf library that im using to generate pdf's from html. Im calling a function thats builds the html and using buffer to return the html to the pdf script. The problem is that when it runs it says the file type is missing or unsupported. Can anyone see if im using the ob_start and ob_get_flush functions correctly in my code below thanks. The pdf part if($_REQUEST['propertyIDs'] != '') { $propertyIDs = explode("|",$_REQUEST['propertyIDs']); foreach ($propertyIDs as $value) { if($value != '') { $html .= draw_property_summary($value); //calls the function that gets the html } } } $old_limit = ini_set("memory_limit", "16M"); $dompdf = new DOMPDF(); $dompdf->load_html($html); $dompdf->set_paper('letter', 'portrait'); $dompdf->render(); $dompdf->stream("dompdf_out.pdf"); exit(0); The draw_property_summary function /* The problem part */ function draw_property_summary($propertyID, $r='') { ob_start(); if($r=='') { $department = property_department($propertyID); $sql = "/* select of fields here etc.. */"; $r = wrapped_query_r_get_row($sql); } $image_query= "select fileds here"; $image_result= mysql_query($image_query) or die(mysql_error()); if($image_result = wrapped_query_r_get_assoc($image_query)){ foreach ($image_result as $image_row){ $imagePath= $image_row['imageURL'].$image_row['propertyID'].'_'.$image_row['imageName'].'_large.jpg'; $img_url = $imagePath; } } else { $img_url = false; } list($postcode,$foo) = split(" ", $r['p_postcode']); $address_line = join_nonempty(", ", array($r['p_street'], $r['p_address4'] . " ".$postcode)); ?> <table valign="top" align="center" cellpadding="2" cellspacing="0" width="95%" border="0"> <tr> <td style="border-bottom: 1px solid rgb(0, 0, 0);" valign="top" width="260"> <?php if($img_url) { ?><img src="<?php echo $img_url; ?>" width="250" height="175"><?php } ?> </td> <td style="border-bottom: 1px solid rgb(0, 0, 0);" valign="top"> <span style="color: rgb(0, 0, 102); font-size: 14px;"> <strong><?php echo $address_line; ?></strong> </span> <br><br> <div style="text-align: justify; font-size:12px;"><?php echo $r['p_summaryDescription']; ?></div> <br><br> <table cellpadding="0" cellspacing="0" width="100%"> <tbody><tr> <td style="color: rgb(153, 0, 0);" width="70%"> <strong>Price:</strong> £<?php echo ($department == 'sales' ? number_format($r['p_sale_price']) : number_format($r['p_rental_price']).' '.$r['p_rental_frequency']); ?> </td> <td><em><?php echo $r['p_tenure']; ?></em> </td> </tr> </table> </td> </tr> </table> $buffer = ob_get_flush(); return $buffer; }
  21. Hey guys thanks for all your input and suggestions. I have fixed the problem and im posting the fix incase any of you come across a problem like this. Fix below $query = " SELECT p.propertyID, p.p_buildingName, p.p_street, p.p_bedrooms, p.negotiator, pds.p_sale_price, pds.propertyID AS isSale FROM property p INNER JOIN property_detail_sale pds ON p.propertyID=pds.propertyID INNER JOIN custom_property_internal_status_sales cpiss ON cpiss.internalStatus=pds.p_sale_internalStatus WHERE p.p_visibility = 'Shown' ".$whereClause." ".($subWhereQuery ? $subWhereQuery : ''); $whereClause = '('; if($_REQUEST['includeArchived'] == 'yes') { $whereClause .= '(cpiss.isArchived = 1 AND cpiss.isPending IS NULL) '; } if($_REQUEST['includeAvailable'] == 'yes') { if($whereClause != '(') { $whereClause .= ' OR '; } $whereClause .= ' (cpiss.isAvailable = 1) '; } if($_REQUEST['includePending'] == 'yes'){ if($whereClause != '(') { $whereClause .= ' OR '; } $whereClause .= ' (cpiss.isPending = 1 AND cpiss.isAvailable IS NULL AND cpiss.isArchived IS NULL) '; } if($_REQUEST['includeUnavailable'] == 'yes') { if($whereClause != '(') { $whereClause .= ' OR '; } $whereClause .= ' (cpiss.isPending = 1 AND cpiss.isAvailable IS NULL AND cpiss.isArchived = 1) '; } $whereClause .= ')'; if($whereClause != '()') { $query .= ' AND '.$whereClause; $query .= " ORDER BY ".$orderBy." LIMIT 200"; } else { $query = 'select false;'; }
  22. SELECT p.propertyID, p.p_buildingName, p.p_street, p.p_bedrooms, p.negotiator, pds.p_sale_price, pds.propertyID AS isSale FROM property p INNER JOIN property_detail_sale pds ON p.propertyID=pds.propertyID INNER JOIN custom_property_internal_status_sales cpiss ON cpiss.internalStatus=pds.p_sale_internalStatus WHERE p.p_visibility = 'Shown' AND (cpiss.isArchived IS NULL) AND (cpiss.isAvailable IS NULL) AND (cpiss.isAvailable = 1 OR cpiss.isPending = 1 AND cpiss.isArchived IS NULL OR cpiss.isPending IS NULL AND cpiss.isArchived = 1) AND (cpiss.isArchived = 1) SELECT p.propertyID, p.p_buildingName, p.p_street, p.p_bedrooms, p.negotiator, pds.p_sale_price, pds.propertyID AS isSale FROM property p INNER JOIN property_detail_sale pds ON p.propertyID=pds.propertyID INNER JOIN custom_property_internal_status_sales cpiss ON cpiss.internalStatus=pds.p_sale_internalStatus WHERE p.p_visibility = 'Shown' AND (cpiss.isArchived IS NULL) AND (cpiss.isArchived = 1)
  23. This is the reult i get when all 4 checkboxes are unticked. SELECT p.propertyID, p.p_buildingName, p.p_street, p.p_bedrooms, p.negotiator, pds.p_sale_price, pds.propertyID AS isSale FROM property p INNER JOIN property_detail_sale pds ON p.propertyID=pds.propertyID INNER JOIN custom_property_internal_status_sales cpiss ON cpiss.internalStatus=pds.p_sale_internalStatus WHERE p.p_visibility = 'Shown' AND (cpiss.isArchived IS NULL) AND (cpiss.isAvailable IS NULL) AND (cpiss.isAvailable = 1 OR cpiss.isPending = 1 AND cpiss.isArchived IS NULL OR cpiss.isPending IS NULL AND cpiss.isArchived = 1) AND (cpiss.isArchived = 1) so this is showing no results which is rite. But when i select the "isAvailable" checkbox or "Unavailable" it stil shows no results which is wrong. This is the query when i check those two checkboxes. SELECT p.propertyID, p.p_buildingName, p.p_street, p.p_bedrooms, p.negotiator, pds.p_sale_price, pds.propertyID AS isSale FROM property p INNER JOIN property_detail_sale pds ON p.propertyID=pds.propertyID INNER JOIN custom_property_internal_status_sales cpiss ON cpiss.internalStatus=pds.p_sale_internalStatus WHERE p.p_visibility = 'Shown' AND (cpiss.isArchived IS NULL) AND (cpiss.isArchived = 1) however if i select the last two boxes "pending" and "archived" first , it returns results then if i select the two that were not working they work correctly. Tabular data id status isAvailable isPending isArchived 1 MA 1 2 PD 1 3 OM 1 4 W 1 5 UO 1 1 6 UN 1 1 7 S 1 1 8 E 1 1
  24. Hey guys, i have this query im trying to write which is 80% working. I have 4 checkboxes and when they are selected or unselected they return or dont return specific data. the problem is, is that when all are unselected and then i select a specific one or two the query does not work it scrambles up. the propblem is in the WHERE part of the query. The $REQUEST pending, unavailable, available and archived get the values from the four checkboxes. any ideas on how to write this query so that if 2 checkboxes are selected or none or all etc they dont interfere with eachother. any help would be greatly appreciated. sql below $query = " SELECT p.propertyID, p.p_buildingName, p.p_street, p.p_bedrooms, p.negotiator, pds.p_sale_price, pds.propertyID AS isSale FROM property p INNER JOIN property_detail_sale pds ON p.propertyID=pds.propertyID INNER JOIN custom_property_internal_status_sales cpiss ON cpiss.internalStatus=pds.p_sale_internalStatus WHERE p.p_visibility = 'Shown' ".($_REQUEST['propertyListShowType'] == 'my' ? " AND p.negotiator = '".userID()."' " : "")." ".($_REQUEST['includeArchived'] == 'no' ? ' AND (cpiss.isArchived IS NULL)' : '')." ".($_REQUEST['includeAvailable'] == 'no' ? ' AND (cpiss.isAvailable IS NULL)' : '')." ".($_REQUEST['includeUnavailable'] == 'no' ? ' AND (cpiss.isAvailable = 1 OR cpiss.isPending = 1 AND cpiss.isArchived IS NULL OR cpiss.isPending IS NULL AND cpiss.isArchived = 1)' : '')." ".($_REQUEST['includePending'] == 'no' ? ' AND (cpiss.isArchived = 1)': '')." ".($subWhereQuery ? $subWhereQuery : '')." ORDER BY ".$orderBy." LIMIT 200";
  25. Hi guys, I have an input box that im validating that the data is numeric. The problemis with the keypress event, when i click the backspace button i want it to do nothing. but at the moment it keeps bringing up my alert and its not working properly any help would be great. also it behaves differently in ie vs firefox. same code below. function validateNumeric(field,e) { var value = field.value; // get input value if(window.event) var key = window.event.keyCode; // ie else if(e) var key = e.which; // firefox if(isNaN(value)) { // check if value is not numeric alert('Please enter numerical data only.'); if(key == { // backspace button key.returnValue=false; } } } <input type="text" size="10" maxlength="10" onkeypress="validateNumeric(this);"> so basically it kind of working with validating that the data is numeric but when they click the backspace button to remove the text from the input box if they did so it keeps bringing up the alert message in the javascript.
×
×
  • 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.