Jump to content

j.g.

Members
  • Posts

    33
  • Joined

  • Last visited

    Never

Everything posted by j.g.

  1. OK, I got the dropdown on the page, now I just need to know how to, IF CHECKED, show another link in another row under it... <tr> <td> <span class="plain_sub_head"> <span class="formlabel">* Link Page:</span> </span> </td> <td> <select name="url" onChange="show_offsite()"> foreach( $urls as $page => $location) { //echo "<option>loc: ".$location; //echo "url: ".$url."</option>"; echo "<option "; if( $url == $location ) { echo "SELECTED"; } echo " VALUE=\"".$location."\">".$page."</OPTION>\n"; } </select> <input type="checkbox" name="add_link"> Add Another Link </td> </tr> Thanks much! -j.g.
  2. Hi All- I have a page that I want to give the user to add more than one link to... right now the default page has a title and one dropdown for a link: <form name="frm" method="post" action="<?php echo $PHP_SELF;?>"> <INPUT TYPE="HIDDEN" NAME="resource_id" VALUE="<?php echo $resource_id;?>" SIZE="50"> <INPUT TYPE="HIDDEN" NAME="operation" VALUE="<?php echo $operation; ?>"> <INPUT TYPE="HIDDEN" NAME="type_id" VALUE="<?php echo $type_id; ?>"> <h1>Add / Update Resources</h1> <table class="box_content" width="80%" border="0" cellpadding="0" cellspacing="0" > <tbody> <tr> <td class="contentnovertical"> <div style="padding: 5px;"> <table border="0" cellpadding="0" cellspacing="5" width="100%"> <tbody> <tr> <td>* Title:</td> <td><input name="title" value="<?php echo $title; ?>" size="50" type="text"></td> </tr> <tr> <td> <span class="plain_sub_head"> <span class="formlabel">* Link Page:</span> </span> </td> <td> <select name="url" onChange="show_offsite()"> foreach( $urls as $page => $location) { //echo "<option>loc: ".$location; //echo "url: ".$url."</option>"; echo "<option "; if( $url == $location ) { echo "SELECTED"; } echo " VALUE=\"".$location."\">".$page."</OPTION>\n"; } </select> </td> </tr> <tr> <td> <span id="offsite_label" style="display: none;">Offsite Link:</span> </td> <td> <span id="offsite_text" style="display: none;"> <input type="text" size="40" maxlength="100" name="offsite_url" value="<?php echo $offsite_url;?>"> </span> </td> </tr> <tr> <td align='center' colspan='2' class="box_heading"> <?php echo $section_heading;?> ( * - required field )</td> </tr> </tbody> </table> </div> </td> </tr> <tr> <td class="contentnovertical"> <div style="padding-top: 5px; padding-bottom: 5px;" nowrap="" align="center"> <input type="submit" class="submit_button" value="<?php echo $operation; ?>" > <A HREF="resources_updater.php?type_id=<?php echo $type_id;?>"><span class="content_text">Cancel</span></A> </div> </td> </tr> </tbody> </table> </form> <script type="text/javascript"> show_offsite(); function show_offsite() { if (document.frm.url.value == 'offsite') { document.getElementById("offsite_text").style.display = "inline"; document.getElementById("offsite_label").style.display = "inline"; } else { document.getElementById("offsite_text").style.display = "none"; document.getElementById("offsite_label").style.display = "none"; } } </script> What I'd like to do is put a checkbox next to the current dropdown asking 'Add Another Link' -- and if this box is checked, show another dropdown under it.... All help will be greatly appreciated! So, I need to add the box, and if it is checked, show another dropdown under it. Please let me know if I need to provide any additional information for you to help me solve this problem. Thanks! -j.g.
  3. Yes! -- I think I can use the function I created and posted w/ my initial post should work to accomplish this, but it's not...
  4. Sorry. Everything is working (file uploads, save title, description, etc) except for the 'Visible' part... I cannot get the dropdown to work correctly. If you're on the page to enter data, the dropdown is visible, but blank - you can either select 'Yes' or 'No' from it -> but if I select 'No', then save it, and click 'Update' on the same record, all the info I've entered is there, but the dropdown is blank (Not saving the 'No'). And, the same with the 'Yes' --> and if it's set to 'Yes' I want to display it on another page, which I'll worry about after getting this issue resolved....I just want to get this backend stuff working first... I just first need to get this value to be saved and then able to switch the values (if 'Yes', change it to 'No', etc). What other information can I provide to help you help me? Thanks again! -j.g.
  5. OK - thanks. Here's my code to Save it to the db: if ($_POST['save'] == 'Save') { $current->processPost($_POST); $current->setParent($parent_id); if ( (strlen($_FILES['FILE']['tmp_name']) > 0) && $_FILES['FILE']['error'] == 0) { $file = new File(); $file->readInFile($_FILES['FILE']['tmp_name'], $_FILES['FILE']['name'], $_FILES['FILE']['name']); $current->addFile($file); } header("Location: govt_relations_faq_updater.php?msg=".urlencode("'".$current->getTitle()."' Saved.")); exit; } My db col's/types pertaining to this: content_id - int(11) unsigned visible - tinyint(1) unsigned Is there any additional info that I'm missing that I could provide? If so, just let me know. Thanks! -j.g.
  6. Hello All! I have a page that asks if the data input by the user should be visible or not -- if yes, it appears on the page, if no, don't show it. I was using a checkbox for this, but discovered that if the user tries to change it from checked to unchecked, it wasn't working correctly; so, I'm now trying a new dropdown function for this -- problem is, it's not saving the choice for each record now...and when you go in to update a record, the drop down is always blank vs. 'Yes' or 'No', depending on what the user selects... How can I fix this? Here's the call to the function in my form: <?= true_false_dropdown('visible', ($current->getVisible() == 1)); ?> And here's my function: // true / false dropdown function true_false_dropdown($name, $default="", $on_change="") { $tf = array ( "false" => "Yes", "true" => "No" ); return (array_dropdown($tf, $name, $default, true, $on_change)); } If anyone could tell me how to fix this, I'd be most appreciative. Thanks for your time and help! -j.g.
  7. Sorry to ask, but could you please provide an example of what you're describing? I'm not sure I understand -- this is all so new to me! :-\ Thanks. -j.g.
  8. Thanks for the reply. I tried making tsize an array and storing the selections in there, but am still getting the same results. Thoughts? Thanks! -j.g.
  9. Thanks for the help! So if anyone else runs into this same issue, this was resolved by tweaking the 'AddAttachment' line: $mail->AddAttachment($_FILES["file_name"]["tmp_name"],$_FILES["file_name"]["name"]); Hope that helps someone else in the future! -j.g.
  10. Hello List! I could really use some help here...I've almost got this working, but need some answers... I have a program that allows users to select a 'New Graduate' membership, and for each one selected, they get a free tshirt. I've got that working using a 'is_new_grad' function that I created. So, if they select 2, they see 2 dropdowns to select the sizes of them. It then sends an email w/ the membership info and the shirt sizes selected. However, when the email is being sent, it's only returning the size of the LAST item selected in from the drop-downs. Example: if I sign up for four of these memberships and select four different tshirt sizes (1 Medium, 1 Lg, 1 XL, and 1 XXL), the info in the email is all XXL: New Graduate T-Shirt Size (included): XXL New Graduate T-Shirt Size (included): XXL New Graduate T-Shirt Size (included): XXL New Graduate T-Shirt Size (included): XXL Here's my code for showing the drop-down boxes: if( is_new_grad() ) //If joined as a 'New Graduate', ask for the T-Shirt size - 1 for each 'New Graduate' membership { while(list($product_id, $quantity) = each($_SESSION["cart_items"])) { for( $count = 1; $count <= $quantity; $count++) { $shirt_sizes = array("M" => "Medium (M)", "L" => "Large (L)", "XL" => "Extra Large (XL)", "XXL" => "Extra Extra Large (XXL)" ); <TR BGCOLOR=#CCCCCC> <TD CLASS="bodytext"><FONT COLOR=#961039>Select T-Shirt Size (included):</font></TD> <TD> </TD> <TD COLSPAN=5 ALIGN=RIGHT> <SELECT NAME="tsize"> <OPTION VALUE="">--Select--</OPTION> foreach( $shirt_sizes as $key => $value ) { echo "<OPTION VALUE='".$key."' "; if( $tsize == $key ) { echo " SELECTED "; } echo " >".$value."</OPTION>\n"; } </SELECT> </TD> </TR> } //end of for loop }//end of while }//END if( is_new_grad() ) And here's the code for sending the email: if( is_new_grad() ) //If joined as a 'New Graduate', ask for the T-Shirt size { while(list($product_id, $quantity) = each($_SESSION["cart_items"])) { for( $count = 1; $count <= $quantity; $count++) { if( $_POST["tsize"] ) { echo "\tNew Graduate T-Shirt Size (included): ".$_POST["tsize"]."\n"; } } } } Please, any solutions and ideas for solving this would be greatly appreciated!! Thank for your time and help!! -j.g.
  11. I've even tried referring to the file directly by using it's 'tmp' value, but still not attaching the file... $mail->AddAttachment($_FILES["file_name"]["tmp"]); Does anyone see what I'm doing wrong? ??? Thanks again! -j.g.
  12. Thanks for the replies! I ended up going the phpmailer route; but, am still at the same spot -- sending email w/ name, phone, and email, but file is not attached. Here's my line for it (what's wrong w/ it??): $mail->AddAttachment($_FILES["file_name"]["name"]); And here's my input field for the file: <div align="left">Attach Resume <input TYPE='FILE' NAME='file_name' "SIZE='40'/> </div> Entire php code: session_start(); require_once("$DOCUMENT_ROOT/includes/form_functions.php"); require_once("$DOCUMENT_ROOT/includes/form_processor.php"); //set up the emailer require_once("$LIBRARY_ROOT/class.phpmailer.php"); $mail = new PHPMailer(); $mail->From = '[email protected]'; $mail->FromName = '[email protected]'; $mail->Subject = 'Employment Form Submission'; $items = array('name', 'email', 'phone', 'resume file'); $required = array(); if( $_POST["submit"] == "Submit" ) { $required = array( "name" => "text", "email" => "text", "phone" => "text" ); $error_msg = form_processor( $required, $_POST, $num_results = 1 ); if( !$error_msg ) { $body = ''; foreach($items as $i => $item) { $body .= ucfirst($item).": ".$_POST[$item]."\n\r"; } $body .= "Sent: ".date('Y-m-d h:i:s')."\n\r"; //send the email $mail->Body = $body; $mail->AddAddress('[email protected]'); $mail->AddAttachment($_FILES["file_name"]["name"]); if ($mail->Send()) { header ("Location: /thankyou.php"); exit(); } else { "There has been an error sending your email to TERM Billing.<br>"; } } } require_once("header.php") Thanks much! -j.g.
  13. Hello List- This is my first time attempting this; but I'd like to add a file selected by the user to the email that is sent to the recipient... I've got the basics done where it's allowing the input for the name, email, phone, and browsing to select a file; and it's sending an email w/ the name, email, and phone in it, but I don't know how to incorporate the attaching of the email to this email. Here's my code: session_start(); require_once("$DOCUMENT_ROOT/includes/form_functions.php"); require_once("$DOCUMENT_ROOT/includes/form_processor.php"); $to = '[email protected]'; $headers = 'From: [email protected]' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $subject = "Employment Form"; $items = array('name', 'email', 'phone', 'resume file'); $required = array(); if( $_POST["submit"] == "Submit" ) { $required = array( "name" => "text", "email" => "text", "phone" => "text" ); $error_msg = form_processor( $required, $_POST, $num_results = 1 ); if( !$error_msg ) { $message = ''; foreach($items as $i => $item) { $message .= ucfirst($item).": ".$_POST[$item]."\n\r"; } $message .= "Sent: ".date('Y-m-d h:i:s')."\n\r"; if (mail($to, $subject, $message, $headers)) { header ("Location: /thankyouform.php"); exit(); } } } require_once("header.php") Any help or direction that you could give me to get this working is greatly appreciated b/c I just cannot get this working! Thanks, -j.g.
  14. But, if the user enters '80,000', that's what I'm storing. And, I also noticed that if I enter a # w/ both a comma and period, it's really messed up -- enter: 1,888.88 --> outputs $1.00 vs. $1,888.88 ???
  15. Well, this function is still returning $80.00, even though 80,000 is in the db -- I'm assuming it has to do w/ the non-numeric comma, as just pointed out... What do I need to change to get the $80,000.00 output instead of $80.00? function format_money($dec, $prefix='$') { return("$prefix".sprintf("%01.2f",round($dec, 2))); } Any ideas? -j.g.
  16. Well, I'm a little bit closer I think; I changed my getListPrice function to: function getListPrice() { //return($this->data["list_price"]); return number_format($this->data["list_price"], 0, "", ","); } and, it's putting the comma in there if the user enters 80000 (output is 80,000) --- However, if the user puts a comma into this field ex: 80,000, it's still returning 80. Any ideas? I'd like them to be able to input the comma... Thanks much! -j.g.
  17. Hello All! I'm working on something that isn't quite working right yet and am hoping someone out there can help me with it. Currently, if the user enters a list_price value of 25,000, my program is changing it to 25; if I enter 25000 (w/o the comma), it's displaying OK, but I'd like to be able to put the comma in the field. What do I need to change/add to accomplish this? Here's my code for it: <tr> <th>List Price</th> <td> <input type=text name='list_price' size=9 value='<?=htmlentities($property->getListPrice(), ENT_QUOTES)?>'> </td> </tr> and my 'getListPrice' function: function getListPrice() { return($this->data["list_price"]); } If I need to supply any additional info, please let me know. Thanks in advance for your time and expertise!! -j.g.
  18. OK - that's why I'm here...I'm not sure how to do it and thought that that would be how, but I guess I was wrong. Any suggestions? Thanks much! -j.g.
  19. Hello List! I'm working on some file uploading code, and need to check the file type and then verify that it's either ".doc, .txt, .pdf, or .xls" -- if it's not one of those, display an error and not upload it. But, I'm not sure how to do this; I think I want to implement $_FILES[my_file_name]["type"] somehow, but I just don't know where to begin or how to implement it??? Would someone out there be able to help me get over this hump that I've been stuck on? Here's my file upload code: elseif (preg_match("/upload/i", $submit)) // $submit == "Save"; { if ($_FILES["glossary_file"]["tmp_name"] ) { if ( move_uploaded_file($_FILES["glossary_file"]["tmp_name"], $uploadpath.$_FILES["glossary_file"]["name"]) ) { $error_msg = "Successfully Uploaded Glossary File"; } else { $error_msg = "Error Uploading Glossary File"; } } else { $error_msg = "Error Uploading Glossary File"; } } Thanks in advance for your help and expertise! -j.g.
  20. Thanks so much, akitchin! It works!! Have a super weekend! -j.g.
  21. Hello List! I've got an issue that I'm hoping someone can help me with... In my db I have 2 fields: first_name and last_name & I want to combine these 2 fields in my drop-down menu. What I have now is showing only the first_name -- I know that it needs to go into the third option in here, I'm just not sure how to get both of them into it. I can get the first_name OR last_name, but not combined. $show_blank = true; $query = "SELECT users.first_name, users.last_name, classification.* FROM users, classification, address ". "WHERE type = 'Membership' ". "AND member_searchable = '1' ". "AND users.classification_id = classification.classification_id ". "AND users.work_address_id != '' ". "AND users.work_address_id = address.address_id ". "ORDER BY users.last_name"; echo query_dropdown($query, 'first_name', 'first_name', "name", $_REQUEST["name"], $show_blank); Any insight and help that you could give me would be greatly appreciated! Thanks, -j.g.
  22. Hi - Thanks for the replies....I think. :-\ There's nothing wrong with arrays, I was just saying 'Without Array' since I'm only using one checkbox -> so I didn't think that an array was neccessary. But, if it is, then by all means, I can implement it with an array! As I said, I'm a Newbie to PHP, so I apologize if my question is a bit on the novice side; that's why I come to this board ... to solve problems and learn new things along the way. I'm sorry if my 'elementary question' offended anybody. frost110 mentioned using sessions... I can look into how to do this; and if anyone else has any other helpful suggestions or ideas to share and aid in my solution, I'm open to hearing them! Thanks! -j.g.
  23. Currently, when I leave the page that the checkbox is on and then come back to it, the checkbox is gone... it's not saving it, it's clearing it out everytime.... Hope that helps! -j.g.
  24. Hi All! I have a question regarding implementing a checkbox that DOESN'T use arrays -- everything i find when i google has arrays in it! So, I'm hoping someone here can help me come up with a solution to my problem. I have a checkbox that a user can check (default will be to have it NOT checked) - and once it's checked, to keep it checked until the user unselects it again. Here's my checkbox code: <input type ="submit" name="cv_permission" type="checkbox"> What do I have to do to keep it turned 'ON' once it's checked? Thanks for your time and help! -j.g.
  25. I tried the following, but am not seeing an difference: echo (nl2br($r["title"])); Anyone have the correct way to do it? -jg
×
×
  • 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.