Jump to content

alexandervj

New Members
  • Posts

    5
  • Joined

  • Last visited

alexandervj's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello, I'm trying to get all the files in a certain directory and display them as links. My code below scans the directory successfully and displays the titles of all the files, but the path to the files must be wrong or something because when you click on the links nothing comes up and the image displayed as a preview is a broken image. I'm not sure whats wrong with my code, any help would be appreciated. Thanks <?php if(is_dir('./uploads/LotID '.$this->uri->segment(3).'/RunID '.$this->uri->segment(4).'/PartID '.$this->uri->segment(5).'/Attachments')){ $dir = './uploads/LotID '.$this->uri->segment(3).'/RunID '.$this->uri->segment(4).'/PartID '.$this->uri->segment(5).'/Attachments'; $files = scandir($dir); if($files){ foreach($files as $f => $file){ if ($file === '.'){ } else if ($file === '..'){ } else { echo '<a href="'.$dir.'/'.$file.'" title="'.$file.'" data-gallery>'; echo '<img src="'.$dir.'/'.$file.'" alt="'.$file.'"><br />'; } } } } else { echo 'No attachments uploaded yet'; } ?>
  2. Hi, I have a MySQL database filled with data from product sheet requests. On our website we have a modal that allows users to request our product sheets. The requests get sent to the database, and also emailed to the group who are responsible for responding to the requests. I would like to set up a cron job to run a php script that connects to the database, then checks to see if a request is older that 24 hours, if it has been marked as 'responded to', - if it is older than 24 hours and not marked as 'responded to' then I want it to send an email reminder to the group that is responsible for responding to the requests. I've been using CodeIgniter so I'm a little rusty on plain PHP and I'm not sure how to go about this. Any help you can give is much appreciated!
  3. Yeah I just want to know how to display the values in the email instead of "Array" or "1". I tried print_r as seen above but that produced the output "1" instead of the names of the product sheets. Here is the code for my form if that hepls as well... <form id="contact" name="contact" method="post" novalidate="novalidate"> <h3>Request Product Sheets</h3> <hr style="margin-top:0px; margin-bottom:0px;"/> <p>Please fill out the form below and product sheets will be sent to the email provided.<br/> * indicates a required field.</p> <fieldset> <table> <tr> <td> <input type="text" name="firstName" id="firstName" placeholder="First Name *" value="" required=""> </td> </tr> <tr> <td> <input type="text" name="lastName" id="lastName" placeholder="Last Name *" value="" required=""> </td> </tr> <tr> <td> <input type="text" name="email" id="email" placeholder="Email *" value="" required=""> </td> </tr> <tr> <td> <input type="text" name="phone" id="phone" placeholder="Phone Number *" value=""> </td> </tr> <tr> <td> <input type="text" name="affiliation" id="affiliation" placeholder="Company/Affiliation" value=""> </td> </tr> <tr> <td> <label for="interest" id="interest">To assist us in understanding your interest in our products are you?</label> <input type="radio" name="interest" id="interest" value="inclusion" checked> Evaluating for inclusion in product<br> <input type="radio" name="interest" id="interest" value="general"> Interested in the technology generally<br> <input type="radio" name="interest" id="interest" value="research"> Performing market research<br> <input type="radio" name="interest" id="interest" value="solutions"> Looking for competitive solutions </td> </tr> <tr> <td> <label style="margin-top:10px;" for="checkbox" id="productSheets">Which products are you interested in?</label> <input type="checkbox" name="productSheets[]" value="lidar"> LiDAR - IR Laser Array Field<br> <input type="checkbox" name="productSheets[]" value="nui"> NUI-IR Laser Array Chip<br> <input type="checkbox" name="productSheets[]" value="optical"> Optical Solutions </td> </tr> <tr> <td> <input style="margin-top:10px;" type="text" name="referredBy" id="referredBy" placeholder="How did you hear about us?" value=""> </td> </tr> <tr> <td> <textarea name="additional" id="additional" placeholder="Additional questions, comments, or requests:"></textarea> </td> </tr> <tr> <td> <input id="submit" type="submit" name="submit" class="btn btn-primary" value="Send"> </td> </tr> </table> </fieldset> </form> <div id="success"> <span style="text-align: center;"> <p>Your request was sent successfully. We will email you shortly with the information you requested.</p> </span> </div> <div id="error"> <span> <p>Something went wrong, try refreshing and submitting the form again.</p> </span> </div>
  4. Here is my code... <?php $to = "email@email.com"; //obviously not real $from = "noreply@domain.com"; //obviously not real $firstName = $_REQUEST['firstName']; $headers = "From: $from"; $subject = "Product Sheet Request"; /* $fields = array(); $fields{"firstName"} = "firstName"; $fields{"lastName"} = "lastName"; $fields{"email"} = "email"; $fields{"phone"} = "phone"; $fields{"affiliation"} = "affiliation"; $fields{"interest"} = "interest"; $fields{"productSheets"} = "productSheets"; $fields{"referredBy"} = "referredBy"; $fields{"additional"} = "additional"; */ $firstName = $_REQUEST['firstName']; $lastName = $_REQUEST['lastName']; $email = $_REQUEST['email']; $phone = $_REQUEST['phone']; $affiliation = $_REQUEST['affiliation']; $interest = $_REQUEST['interest']; if($interest == 'inclusion'){ $interest = 'Evaluating for inclusion in product'; } elseif($interest == 'general'){ $interest = 'Interested in the technology generally'; } elseif($interest == 'research'){ $interest = 'Performing market research'; } elseif($interest == 'solutions'){ $interest = 'Looking for competitive solutions'; } $referredBy = $_REQUEST['referredBy']; $additional = $_REQUEST['additional']; $productSheets[] = $_REQUEST['productSheets']; $sheets = print_r($productSheets); /* $body = "A user has requested product sheet(s). Please review their information and respond:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); } */ $body = "A user has requested product sheet(s). Please review their information and respond:\n First Name: ".$firstName."\r Last Name: ".$lastName."\r Email: ".$email."\r Phone Number: ".$phone."\r Affiliation: ".$affiliation."\r Reason for Interest: ".$interest."\r Referred By: ".$referredBy."\r Additional Questions/Comments: ".$additional."\r Product Sheet(s) Requested: ".$sheets."\n "; $send = mail($to, $subject, $body, $headers); ?> I'm not quite sure how to display the values of the $productSheets array in the email message. Everytime it either outputs "Array" or "1". The $productSheets array is from a checkbox on a form. Everything else is working as expected.
×
×
  • 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.