Jump to content

fat creative

Members
  • Posts

    41
  • Joined

  • Last visited

    Never

Everything posted by fat creative

  1. This is the code. I was originally testing paypals IPN and it wasn't working. I finally stripped everything down to a single update statement and thats when I discovered it wasnt the IPN, it was updating with phpmyadmin. My workaround is I'm just not updating with phpmyadmin anymore, I am using this form. Now that I have the workaround, the form has grown quite a bit in complexity. But the problem existed when I was updating a single text field. include('inc/dbc.php'); $email = $_POST['email']; $city = $_POST['city']; $featured = $_POST['featured']; $today=date(Ymd); $item_name = $_POST['item_name']; // this will check what item was purchased, 1, 3 6 or 12 months and set the end date of the featured item to today PLUS that time lenght if ($item_name == 'Subscription term: 1 month') { $featured_end_date = date('Y-m-d', strtotime('+1 month')); } if ($item_name == 'Subscription term: 3 months') { $featured_end_date = date('Y-m-d', strtotime('+3 month')); } if ($item_name == 'Subscription term: 6 months') { $featured_end_date = date('Y-m-d', strtotime('+6 month')); } if ($item_name == 'Subscription term: 12 months') { $featured_end_date = date('Y-m-d', strtotime('+12 month')); } $query = "SELECT * FROM vendors WHERE email = '$email'"; $result = mysql_query($query) or die ("There was an error:<br />".mysql_error()."<br />Query: $query"); if(mysql_num_rows($result)) //if a record is found!!! { $ok = mysql_query("UPDATE vendors SET featured_end_date = '$featured_end_date', featured_start_date = '$today', featured = '$featured' WHERE email = '$email'") or die(mysql_error()); if($ok) { echo "record updated. city is $city and emai lis $email and featured is $featured and featured start date is $today and end date is $featured_end_date"; } else { echo "sorry didint work"; } } else { $ok = mysql_query("INSERT INTO vendors (email, password, featured, featured_start_date, featured_end_date, active) VALUES('". mysql_escape_string($email) ."', 'password' ,'yes','$today','$featured_end_date', 'yes') ") or die(mysql_error()); if($ok) { $query1k = "SELECT * FROM vendors WHERE email = '$email'"; $result1k = mysql_query($query1k); while($row = mysql_fetch_array($result1k, MYSQL_ASSOC)) { $sr = "sr"; $sr .= "$row[ttd]"; $sr2 = "sr2"; $sr2 .="$row[ttd]"; $sr3 = "sr3"; $sr3 .="$row[ttd]"; $sr4 = "sr4"; $sr4 .="$row[ttd]"; $ok1 = mysql_query("UPDATE vendors SET sr_ttd = '$sr', ttd2 = '$sr2', ttd3 = '$sr3', ttd4 = '$sr4' WHERE email = '$email'"); } echo "record INSERTED. city is $city and emai lis $email and featured is $featured and featured end date is $today"; } else { echo "sorry didint work"; } } Thank you for any suggestions!
  2. I have come across a problem in a database I am working with. I have a work around, but am still curious as to why this is happening and wondered if anyone else has experienced such a thing. I have a form that updates my database. I submit it and it updates fine. However, if I edit the database using phpmyadmin and then submit the form again, it will no longer update that field in the database. My form is updating a field to say YES and I edited it again in phpmyadmin to say NO and submit the form again, just to confirm everything is working. It won't update the database on the second submit. However, I can submit the form several times and have it update different information in that field and it works. Its only as soon as I update with phpmyadmin, the submit will no longer update that field. It will update other fields, just not the one I edited in phpmyadmin. Does anyone have any idea why this would happen? Thanks in advance for any help.
  3. Okay, I seem to have half of this working and this is the code if anyone could use it on another project. Seems to work using CSS. I got this code from the CSS library. /* ========== popup images for coupons =========== */ /*Credits: Dynamic Drive CSS Library */ /*URL: http://www.dynamicdrive.com/style/ */ .thumbnail{ position: relative; z-index: 0; color: #603814; text-decoration: italic; font-size: 14px; font-weight: normal; } .thumbnail:visited { /* this is the text color of the visited links*/ position: relative; z-index: 0; color: #603814; text-decoration: none; font-size: 14px; font-weight: normal; } .thumbnail:hover{ /* this is the text color when you hover over it*/ background-color: transparent; z-index: 50; text-decoration: none; font-size: 14px; color: #a52620; font-weight: normal; } .thumbnail span{ /*CSS for enlarged image*/ position: absolute; background-color: #663300; padding: 5px; left: -1000px; /* border: 1px dashed gray;*/ visibility: hidden; /* display:none;*/ color: #a52620; text-decoration: none; font-weight: normal; } .thumbnail span img{ /*CSS for enlarged image*/ border-width: 0; padding: 2px; font-weight: normal; } .thumbnail:hover span{ /*CSS for enlarged image on hover*/ visibility: visible; top: 0; left: 60px; /*position where enlarged image should offset horizontally */ font-weight: normal; } Then I slightly modified the code from the earlier referenced tutorial as follows: <?php //this is the mouseover.php file $img_number = imagecreatefrompng ("images/blankcoupon.png"); $number = "this is my new specials text"; Imagestring($img_number,19,50,75,$number,$black); header("Content-type: image/jpeg"); imagejpeg($img_number); ?> These are in two different files and the html code calls the php file as follows: echo "<a class=\"thumbnail\" href=\"#thumb\">$special<span><img src=\"http://site/~peach/mouseover.php\" /><br /></span></a>"; echo "</td></tr>\n"; The $special variable will display the first 40 characters of text on the site and then the mouseover should display all the text. What's displaying now is the $number text. I tried replacing that with $special, but it didn't show anything. What I can't seem to figure out now is how to pass the $special variable to the mouseover.php file. I'm not submitting anything like a form, so I don't think a _POST or _GET will work. It needs to happen on the fly. Does anyone have any thoughts on how to pass this information from the html page to the php page? Thank you so much for any suggestions!
  4. :-) I wasn't asking anyone to do my work for me. I was asking for suggestions, directions, advice, code SAMPLES (which I have gotten here before), etc which you have managed to provide. Thank you for that. I didn't copy code here as I have gone through dozens of tutorials and my code changes hour to hour. I could not get the original tutorial to create an image which is what I meant by I couldn't get it to work. I did get the tutorial you provided to create a square and generate a random image. I'm guessing I can change the random image to something that will get the information from my database by using select statements. I'm not sure what to change to get the background to be an image, not solid gray and that's what I seem to be missing in all of the tutorials I have found. I provided all that detail of what I am trying to do as I didn't think I explained myself well enough before and was simply trying to explain better. Here is my code as it is right now. It's simply the tutorial you provided (again, thank you). <?php header("Content-type: image/jpeg");?> <?php //random_number.php $img_number = imagecreate(100,50); $white = imagecolorallocate($img_number,255,255,255); $black = imagecolorallocate($img_number,0,0,0); $grey_shade = imagecolorallocate($img_number,204,204,204); imagefill($img_number,0,0,$grey_shade); ImageRectangle($img_number,5,5,94,44,$black); ImageRectangle($img_number,0,0,99,49,$black); $number = get_random(); Imagestring($img_number,9,30,15,$number,$black); header("Content-type: image/jpeg"); imagejpeg($img_number); function get_random() { srand(time()); $max = getrandmax(); return rand(1,$max) + rand(1,$max) ; } ?> This is called from a file with this code: <img src='http://www.mysite.com/random_number.php' /> THIS ONE IS WORKING <img onMouseOver="http://www.MYSITE.com/random_number.php">my image is here THIS ONE ISN'T WORKING, I AM STILL TRYING TO FIGURE OUT THE ONMOUSEOVER. So, anyone, thank you in advance for any help. It is truly appreciated.
  5. Thank you for the info. I have spent the last few weeks trying to get this to work with no avail. I've gone through this tutorial again and I just don't see it as what I am really looking for. What I will have is a database with name and special and featured (yes/no). If featured is a yes, then the name appears. When you mouseover the name, an image will appear and will automatically add in the text from the specials column on top of it. There will be multiple people who are featured = yes and they will each have their own special. At this point I have nothing. I thought it would be pretty simple and committed to do it, but now I am clueless how to even get started. ANY suggestions, direction, advice, code, would be appreciated. Thank you.
  6. I read that post before creating my post. Unless I'm totally missing it, it seems to be doing text on a square with the background colors changing. I've seem lots of tutorials on that, but it's not quite I'm needing. And unfortunately, I'm quite a newbie and I'm not sure what to change to get what I need.
  7. I am trying to code the following: when you mouse over a word, an image will popup. Obviously I can do this with javascript no problem. But I need a standard background image to always appear and then the text on the image to change based on whats in the database. For example, if clientid=1, then put the client name, address, etc on an image. If clientid=2, put the new client name, address, etc on the same image. Can anyone offer any suggestions? I have seen code to change the background color of a square and then I can make my php statements to retrieve the text I need, I can do a javascript onmouseover, but I can't seem to get that to work with a php file. I'm just not sure which way to go from here. ANY help would be appreciated!
  8. I'm open to changing the code completely, if anyone can suggest how. I'm a newbie to PHP and know nothing about Javascript, so I'd really appreciate any direction. Thanks everyone!
  9. I have a dynamic menu in a form where the user makes a selection in the first drop down and their choice populates the 2nd drop down. It was written in javascript and works great. What I can't figure out is how to get the selection the user makes written to my database. I have worked with array's before, but this one looks a bit different to me and I quite figure out what to do. If anyone could offer any direction, I would so appreciate it! The page with the form is at http://174.34.155.2/~farmers/join.php and the drop down is under the date / location section. The javascript section looks like this.... team = new Array( new Array( new Array("January 12"), new Array("January 19"), new Array("January 26"), new Array("February 2") ), new Array( new Array("January 10"), new Array("January 17"), new Array("January 24"), new Array("January 31") ), new Array( new Array("January 10", 23840238), new Array("January 17", 92390484), new Array("January 24", 29048203), new Array("January 31", 29345423) ), new Array( new Array("January 10", 23840238), new Array("January 17", 92390484), new Array("January 24", 29048203), new Array("January 31", 29345423) ), new Array( new Array("January 10", 20394802), new Array("January 17", 34982039), new Array("January 24", 92348902), new Array("January 31", 98234902) ) ); function fillSelectFromArray(selectCtrl, itemArray, goodPrompt, badPrompt, defaultItem) { var i, j; var prompt; // empty existing items for (i = selectCtrl.options.length; i >= 0; i--) { selectCtrl.options = null; } prompt = (itemArray != null) ? goodPrompt : badPrompt; if (prompt == null) { j = 0; } else { selectCtrl.options[0] = new Option(prompt); j = 1; } if (itemArray != null) { // add new items for (i = 0; i < itemArray.length; i++) { selectCtrl.options[j] = new Option(itemArray[0]); if (itemArray[1] != null) { selectCtrl.options[j].value = itemArray[1]; } j++; } // select first item (prompt) for sub list selectCtrl.options[0].selected = true; } } //--> Thanks!
  10. I have a a flash file reading a php file and as long as the php file says select EVERYTHING from the database, it works beautifully. However, when I pass a variable from flash to the php file, I can see in the browser that the variable is passed and the records are retrieved correctly when I look at the page through the browser, however, in Flash it displays a [type Function] error message instead of displaying the records. Does anyone have any ideas? I tried doing this several different ways, I've looked at amfphp, but my flash file is written in actionscript 2.0 and these other solutions have seemed to need 3.0. Thanks in advance for any suggestions!
  11. Thanks for the response. I looked over the amfphp thing and its honestly greek to me. If there are any other suggestions, I would very much appreciate it. I'm afraid the amf will take me the rest of the year to figure out.
  12. I am trying to send a variable (state = selection) from Flash to PHP, have that pull records from my database and then return the information to Flash in a new Frame. I cannot get it to work. When my PHP file (therapist.php) says to select everything from the table, it works fine. But when I try to get it to select what was passed from Flash, it will not work. I think it's not passing anything from therapists.php to therapists2.php, but I'm not sure how to get it to do that. Therapists2.php is creating an xml file. When I put everything into one file, I get an error message which is why I split it into two files. My scripst are as follows: frame name therapist_select actionscript stop(); var serverLang:String = "asp"; //Create a loadvars object named email_lv var state_search_lv:LoadVars = new LoadVars(); //this function is called when email_lv loads the server-side script. state_search_lv.onLoad = function(success) { if (success) { if (state_search_lv.state_search_mes == "ok") { gotoAndPlay ("therapist"); } } else { search_status_txt.text = "failed"; } }; state_search_btn.onRelease = function() { if (!state_list.selected) { search_status_txt.text = "Select state"; } else { state_search_lv.state_list = state_list.getValue(); state_search_lv.sendAndLoad("http://www.fatcreative.com/mmbr/therapists.php", state_search_lv, "POST"); } }; Frame name therapist actionscript = var xml:XML = new XML(); xml.ignoreWhite = true; xml.onLoad = function() { theTree.dataProvider = this.firstChild; } xml.load("http://www.fatcreative.com/mmbr/therapists2.php"); var treeL:Object = new Object(); treeL.change = function() { var item = theTree.selectedItem; var desc = item.attributes.description; var earl = item.attributes.url; if(earl) { getURL(earl,"_self"); } } theTree.addEventListener("change",treeL); theTree.setStyle("indentation", 20); theTree.setStyle("disclosureOpenIcon","TreeDisclosureOpen"); theTree.setStyle("disclosureClosedIcon","TreeDisclosureClosed"); theTree.setStyle("folderClosedIcon", "blankicon"); theTree.setStyle("folderOpenIcon", "blankicon"); theTree.setStyle ("defaultLeafIcon","blankicon"); stop(); therapists.php file $state = $_POST['state_list']; $ok = $query = "SELECT * FROM therapists"; //this line sends the mail and returns true or false if($ok) { echo "&state_search_mes=ok&"; //if mail was send print to the screen "&server_mes=ok" } else { echo "&state_search_mes=fail&"; // if mail was NOT sent, print to the screen "&server_mes=fail" } //$query = "SELECT * FROM therapists WHERE state = $state"; $query = "SELECT * FROM therapists"; $results = mysql_query($query); echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; echo "<therapists>\n"; while ($line = mysql_fetch_assoc($results)) { echo "<folder label=\"" . $line["name"] ."\" >\n"; echo "<info label=\"- Specialty: " . $line["modality"] ."\" />\n"; echo "<info label=\"- Price Range: " . $line["price_range"] ."\" />\n"; echo "<info label=\"- Gender: " . $line["gender"] ."\" />\n"; echo "<info label=\"- Licensed: " . $line["licensed"] ."\" />\n"; echo "<info label=\"- Years of Experience: " . $line["years_exp"] ."\" />\n"; echo "<info label=\"Visit My Page\" " . "url=\"" . $line["website"] ."\" />\n"; echo "</folder> \n"; } echo "\n"; echo "</therapists>\n"; therapists2.php file $query = "SELECT * FROM therapists"; $results = mysql_query($query); echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; echo "<therapists>\n"; while ($line = mysql_fetch_assoc($results)) { echo "<folder label=\"" . $line["name"] ."\" >\n"; echo "<info label=\"- Specialty: " . $line["modality"] ."\" />\n"; echo "<info label=\"- Price Range: " . $line["price_range"] ."\" />\n"; echo "<info label=\"- Gender: " . $line["gender"] ."\" />\n"; echo "<info label=\"- Licensed: " . $line["licensed"] ."\" />\n"; echo "<info label=\"- Years of Experience: " . $line["years_exp"] ."\" />\n"; echo "<info label=\"Visit My Page\" " . "url=\"" . $line["website"] ."\" />\n"; echo "</folder> \n"; } echo "\n"; echo "</therapists>\n"; Does anyone have any idea how to pass the variable from one file to the other? I also tried starting a session, but I got error messages with that one too. Or is there another way of doing this? I am new to AS, and just a beginner with PHP, so any help would be greatly appreciated. The site can be seen at http://www.FatCreative.com/mmbr and the action all takes place when you click on the Find a therapist link. Thanks again!
  13. I have a form that is dynamically created based on selections from a previous page. In the form, there are several checkboxes and each checkbox has a unique name. When this form is submitted, it checks whether each unique checkbox is either true or false and then sends mail based on that selection. What I need to add to this is the ability to select ALL checkboxes before submitting the form. I can do this in javascript, but that seems to need all the checkboxes to have the same name / different id. They all need to have a different name so I can evaluate them on the next page to send mail. I was hoping that if I put in all possible checkbox names, the javascript would just skip what doesnt exist, but instead it created an error message. I turned off the error messages, but it just stops the script, it won't just skip the line with the error in it. Does anyone know of a way to do this in PHP? Or anyway???? :-) I can't seem to get past this and I think it's the last thing I need for my project. I don't know javascript at all, and am quickly learning PHP, so any advice would be appreciated. Thanks in advance!
  14. mrdamien, thank you very much for all the help! Right now, I have the site done in my backwards way of doing it and since its due tomorrow, I'm giving it to the client this way. What I ended up doing was writing an if statement to see if each checkbox is "on". If it was, it sends the email. Then it checks the next checkbox. While it works, I know its not the best way as I had to create almost 500 if statements, one for each possible checkbox that could be on the page. However, I am making a copy of everything to play with on my own so i can learn how to do it the right way for the next project. The client did mention possibly updating some things later in the week and hopefully I can update the site with the better way. Thank you again, so very much. I have learned quite a bit with this project and am looking forward to the day that I can help others with their problems!
  15. Sorry, I haven't worked with arrays so I didn't really know what that was. I watched some video tutorials at killerphp.com last night, so I think I understand what to do, I just need to change the options to whats in my data. So I have id 126 ->email@email.com and I do that for the entire list. But I still don't understand what to do with it next. As far as the flow, yes that is correct in terms of what I can't get to work. The start of congress.php also emails the form data but I think I have that part working. On the congress.php form, I also need to add in a select all option, but I THINK I know how to do that. Late last night, I did come up with a very backwards way of getting this to work so I feel less pressure for the Monday deadline, but I'd still like to know how to do it the RIGHT way, so again, any other help would be appreciated. Thanks again!
  16. Thank you for the suggestions on how to fix this the RIGHT way! I have updated my code, but it's giving me an error message that I can't get past. I was getting a few along the way and had to make some minor changes, so I hope I didn't mess up the logic of what you sent. The error message is coming up after calling the sendmail.php page. I would be so grateful for any other help. The congress.php file is now updated as follows: # GRAB THE VARIABLES FROM THE FORM $state = mysql_real_escape_string($_POST['state']); $fname = mysql_real_escape_string($_POST['fname']); $lname = mysql_real_escape_string($_POST['lname']); $address1 = mysql_real_escape_string($_POST['address1']); $address2 = mysql_real_escape_string($_POST['address2']); $city = mysql_real_escape_string($_POST['city']); $zip = mysql_real_escape_string($_POST['zip']); $useremail = mysql_real_escape_string($_POST['useremail']); //this will email the form from the takeaction.html page $mailTo = "jfolkes@fatcreative.com"; $msgSubject = "Menthol Choice email"; $msgBody = "$salutation, $fname, $lname, $useremail, $address1, $address2, $city, $state, $zip, $country, $age, $email_pref"; $xHeaders = "From: $useremail\nX−Mailer: PHP/" . phpversion(); mail ($mailTo, $msgSubject, $msgBody, $xHeaders); //this should select based on form selections $query = "SELECT * FROM Sheet1"; $query = "SELECT * FROM Sheet1 WHERE state LIKE '%$state%'"; echo $state; echo "<br /><br />"; $result = mysql_query($query) or die ("There was an error:<br />".mysql_error()."<br />Query: $query"); if(!mysql_num_rows($result)) //if none!!! { echo "There were no records returned from the database"; } else //otherwise draw the table { //put info on new lines echo "<form action=\"http://www.mentholchoice.com/sendmail.php?$useremail\" method=\"post\">"; echo "Click on a congressman to send email <br /><br /><br />"; echo "<table cellspacing=\"15\">\n"; while($row = mysql_fetch_assoc($result)) { extract($row); echo "<tr><td valign=\"top\">"; echo "<td valign=\"top\"><div align=\"left\"><b><span class=\"style5\">$name</span></b></div>"; echo "<td valign=\"top\"><span class=\"style12\">$party</span>"; echo "<td valign=\"top\"><span class=\"style12\">$district_phone</span>"; echo "<td valign=\"top\"><span class=\"style12\">$dc_phone</span>"; $radio = $ID; if ($email == "NA") { echo "<td valign=\"top\"><span class=\"style12\"></span>"; } else { echo "<td valign=\"top\"><span class=\"style12\"><input type=\"checkbox\" name=\"id[<?php echo $id; ?>]\" value=\"1\" /></span>"; } echo "<td valign=\"top\"><div align=\"left\"><b><span>$email $ID</span></b></div></div></a>"; echo "</td></tr>\n"; } } echo "</table>\n"; echo " <label>"; echo " <input type=submit name=\"Send email\" id=\"Send email\" value=\"Submit\" />"; echo " </label>"; echo "</form>"; ?> And the sendmail.php file has been updated as follows: # GRAB THE VARIABLES FROM THE FORM $_POST['id'] = array( '1' => '1', '2' => '1', '3' => '1', '4' => '1', '5' => '1' ); foreach($_POST['id'] as $id=>$one){ //SQL $query = ("select email from Sheet1 where ID = $id"); $email = getRow(); $sent = mail($email) ; if($sent) {print "Your mail was sent successfully"; } else {print "We encountered an error sending your mail"; } } $query = "SELECT * FROM Sheet1"; $result = mysql_query($query) or die ("Couldnt execute query. It's not working."); ?> thank you
  17. I am pulling my hair out at this point and have tried everything I can think of. Any help would be so very appreciated. I have a form that selects from a database based on the state selected. It then queries my database and returns all the results where state equals whatever was selected and it creates the page congress.php. When it returns the selection, it creates a table where it displays the name, email, and phone number along with a checkbox. I have given each checkbox a unique name equal to the ID number of that record. What I am trying to do is to send an email based on whether the checkbox is selected or not. I cannot for the life of me figure out how to get it to do this. I have this information in a form and when the form is submitted it calls a file sendmail.php. I had this all working earlier today where it would send an email if you clicked on the persons name. The client has requested the ability to send to all people if they are selected instead and this project is due Monday. In seeing that I don't have a lot of time, I gave up trying to figure this out and decided I'd just add in EVERY possible variable for the checkbox (I know not the right or best way, but I am really short on time) and I tried to put in a statement that says if the radio box equals on, then query the database for all records where the ID equals some number and echo the email. What I was hoping to do is to get all the emails for the checkboxes that are on and somehow append them all together. I am SURE this is a completly backwards way of doing this, but I am pretty new to PHP. I am quite pleased with myself for what I did figure out so far on my own, but I am really stumped at this point. Please please please, can anyone offer some suggestions. And suggestions that a newbie would understand :-). This is my code from sendmail.php. Right now all I can see is that the checkbox is returning "on". # GRAB THE VARIABLES FROM THE FORM $radio126 = mysql_real_escape_string($_POST['126']); if ($radio126 == "on") { $query = "SELECT * FROM Sheet1 WHERE ID == '126'"; echo $email; } else { echo "radio is not selected"; } echo $radio126; echo "<br />"; $query = "SELECT * FROM Sheet1"; $result = mysql_query($query) or die ("Couldnt execute query. It's not working."); ?> thank you (this I put in just to see it return something) This is the code from the congress.php file. $query = "SELECT * FROM Sheet1"; $result = mysql_query($query) or die ("Couldnt execute query. It's not working."); # GRAB THE VARIABLES FROM THE FORM $state = mysql_real_escape_string($_POST['state']); $fname = mysql_real_escape_string($_POST['fname']); $lname = mysql_real_escape_string($_POST['lname']); $address1 = mysql_real_escape_string($_POST['address1']); $address2 = mysql_real_escape_string($_POST['address2']); $city = mysql_real_escape_string($_POST['city']); $zip = mysql_real_escape_string($_POST['zip']); $useremail = mysql_real_escape_string($_POST['useremail']); //this should select based on form selections $query = "SELECT * FROM Sheet1"; $query = "SELECT * FROM Sheet1 WHERE state LIKE '%$state%'"; echo $state; echo "<br /><br />"; $result = mysql_query($query) or die ("There was an error:<br />".mysql_error()."<br />Query: $query"); if(!mysql_num_rows($result)) //if none!!! { echo "There were no records returned from the database"; } else //otherwise draw the table { //put info on new lines echo "<form action=\"http://www.mentholchoice.com/sendmail.php?$useremail\" method=\"post\">"; echo "Click on a congressman to send email <br /><br /><br />"; echo "<table cellspacing=\"15\">\n"; while($row = mysql_fetch_assoc($result)) { extract($row); echo "<tr><td valign=\"top\">"; echo "<td valign=\"top\"><div align=\"left\"><b><span class=\"style5\">$name</span></b></div>"; echo "<td valign=\"top\"><span class=\"style12\">$party</span>"; echo "<td valign=\"top\"><span class=\"style12\">$district_phone</span>"; echo "<td valign=\"top\"><span class=\"style12\">$dc_phone</span>"; $radio = $ID; if ($email == "NA") { echo "<td valign=\"top\"><span class=\"style12\"></span>"; } else { echo "<td valign=\"top\"><span class=\"style12\"><input type=\"checkbox\" name=\"$radio\" id=\"sendto\" /></span>"; } echo "<td valign=\"top\"><div align=\"left\"><b><span>$email $ID</span></b></div></div></a>"; echo "</td></tr>\n"; } } echo "</table>\n"; echo " <label>"; echo " <input type=submit name=\"Send email\" id=\"Send email\" value=\"Submit\" />"; echo " </label>"; echo "</form>"; ?> the site is currently posted at http://www.mentholchoice.com/takeaction.html Thank you so much again to anyone who can help!!!!!
  18. Well with a bit more putzing around, I figured it out. I'll post the answer in case it helps anyone else. On the statement that checks for file types, I added in AND $upload_Mime_Type != "" so if there was NO filename entered, it would not produce an error. Thank you everyone for your help and suggestions! Jeanette
  19. What happens is, with the script unmodified, when I hit upload and do not enter a filename, I get an error message that basically says I did not enter a file to upload (which is one of the checks in the script). When I comment out that section, and hit upload without entering a filename, I get an error message that says I was trying to upload an invalid file type (I was uploading nothing, and that is another check in the script). What I am hoping to do is, if I do not enter a file to upload, that it checks nothing and just emails me the information in the name, email and story box. However, if I do enter a filename to upload, then it will perform the size and file type checks.
  20. I am new to php and trying to update a script I found somewhere. I want a user to be able to add their name and email address and have the option to either add comments or upload an image. The script was originally just uploading an image. I added in the comment field and it does email the comments to me. The problem is if the user just adds comments and no image. Part of the script checks for file size equals 0 (meaning they did not upload anything). I commented that out so it's not a requirement to upload an image. However, then the script checks for valid file types (images only) and still produces an error message. I can't seem to figure out how to get it to skip this section. IF the user uploads an image, then I do want it to check the size and file type. But if they don't upload an image, I just want it to skip that. The URL is here: http://www.amtrakfamilyreunions.com/email-image-upload.html My code is pasted below. If anyone could offer some suggestions, I would very much appreciate it. <?php # ---------------------------------------------------- # ----- EMAIL IMAGE UPLOAD # ----- Version 4.1 # ----- Created on: 02/04/07 # ----- Designed by: American Financing # ----- http://www.americanfinancing.net # ----- Free Appraisal! 2 Hour Pre-Approval 1 Week Closing. Now That's Service! # ----- PLEASE FEEL FREE TO MODIFY THIS SCRIPT TO YOUR NEEDS # ----- ENJOY!!! # ---------------------------------------------------- include("header.html"); @$Name = addslashes($_POST['Name']); @$email = addslashes($_POST['email']); @$story = addslashes($_POST['story']); @$upload_Name = $_FILES['upload']['name']; @$upload_Size = $_FILES['upload']['size']; @$upload_Temp = $_FILES['upload']['tmp_name']; @$upload_Mime_Type = $_FILES['upload']['type']; function RecursiveMkdir($path) { if (!file_exists($path)) { RecursiveMkdir(dirname($path)); mkdir($path, 0777); } } if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email)) { die("<p align='center'><b><font face='Arial Black' size='5' color='#FF0000'>Please enter a valid email</font></b></p>"); } /* if( $upload_Size == 0) { die("<p align='center'><b><font face='Arial Black' size='2' color='#FF0000'>ERROR<br>upload size == 0 <br>PLEASE CHECK THE FILE SIZE AND FORMAT</font></b></p>"); } */ // CHANGE THIS TO A HIGHER OR LOWER VALUE - REMEMBER HOSTING LIMITS if( $upload_Size >2000000) //-------- { unlink($upload_Temp); die("<p align='center'><b><font face='Arial Black' size='2' color='#FF0000'>ERROR<br>upload size > 2mgs <br>PLEASE CHECK THE FILE SIZE AND FORMAT</font></b></p>"); } if( $upload_Mime_Type != "image/cgm" AND $upload_Mime_Type != "image/g3fax" AND $upload_Mime_Type != "image/gif" AND $upload_Mime_Type != "image/ief" AND $upload_Mime_Type != "image/pjpeg" AND $upload_Mime_Type != "image/jpeg" AND $upload_Mime_Type != "image/naplps" AND $upload_Mime_Type != "image/png" AND $upload_Mime_Type != "image/prs.btif" AND $upload_Mime_Type != "image/prs.pti" AND $upload_Mime_Type != "image/tiff" AND $upload_Mime_Type != "image/vnd.cns.inf2" AND $upload_Mime_Type != "image/vnd.dwg" AND $upload_Mime_Type != "image/vnd.dxf" AND $upload_Mime_Type != "image/vnd.fastbidsheet" AND $upload_Mime_Type != "image/vnd.fpx" AND $upload_Mime_Type != "image/vnd.fst" AND $upload_Mime_Type != "image/vnd.fujixerox.edmics-mmr" AND $upload_Mime_Type != "image/vnd.fujixerox.edmics-rlc" AND $upload_Mime_Type != "image/vnd.mix" AND $upload_Mime_Type != "image/vnd.net-fpx" AND $upload_Mime_Type != "image/vnd.svf" AND $upload_Mime_Type != "image/vnd.wap.wbmp" AND $upload_Mime_Type != "image/vnd.xiff" ) { unlink($upload_Temp); die("<p align='center'><b><font face='Arial Black' size='2' color='#FF0000'>ERROR<br>invalid file type<br>PLEASE CHECK THE FILE SIZE AND FORMAT</font></b></p>"); } $uploadFile = "uploads/".$upload_Name ; if (!is_dir(dirname($uploadFile))) { @RecursiveMkdir(dirname($uploadFile)); } else { @chmod(dirname($uploadFile), 0777); } @move_uploaded_file( $upload_Temp , $uploadFile); chmod($uploadFile, 0644); //CHANGE THIS TO THE YOUR DOMAIN $upload_URL = "http://www.AmtrakFamilyReunions.com/uploads/".$upload_Name ; //------------ $pfw_header = "From: $email"; $pfw_subject = "AN IMAGE HAS BEEN UPLOADED"; // CHANGE THIS TO YOUR EMAIL ADDRESS $pfw_email_to = "info@fatcreative.com"; //------------ $pfw_message = "email: $email\n" . "Name: $Name\n" . "story: $story\n" . "upload: $upload_URL\n"; @mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ; echo("<p align='center'><b><font face='Arial Black' size='2' color='#0000FF'>THANK YOU!<br>YOUR IMAGE HAS BEEN UPLOADED</font></b></p>"); include("footer.html"); ?>
  21. You certainly did! The things that seem like they should be so easy frustrate me the most. I unfortunately just missed signing up for a class at the local college when this project came up. I am definitely signing up the next semester. And I remember you said you had a conference coming up here in GA. I hope that link for the list of things to do in Atlanta was helpful. YES it is VERY HOT. Well humid. You will pretty much walk outside and be SOAKED in a matter of minutes. Be warned. :-) And thanks again...
  22. Noone's crazy here, just much much smarter than me. I didn't realize it mattered if the statement was in the while loop. I have SO MUCH to learn. Thank you, Darkwater, Bther - you were both spot on!
  23. I'm trying to limit the number of characters returned and have the following code: $query = "SELECT * FROM GFF WHERE featured_site = 'yes'"; $result = mysql_query($query) or die ("Couldnt execute query"); $prop = substr($prop_desc, 0, 150); echo "<table cellspacing=\"15\">\n"; while($row = mysql_fetch_assoc($result)) { extract($row); echo "<tr><td valign=\"top\">"; echo "<img src=\"$thumb_image\" width=\"125\" height=\"94\" align=\"middle\" ></td>"; echo "<td valign=\"top\"><a href=\"showdetails.php?id_number=$id_number\"><b>$prop_title</b></a><br />"; echo "$prop<br />"; echo "<a href=\"showdetails.php?id_number=$id_number\"><div align=\"right\"><b>View Details</b></div></a>"; echo "</td></tr>\n"; } echo "</table>\n"; It looks like such a simple thing, but as a newbie, I'm obviously missing something since it's not working! My page is at www.FatCreative.com/GFF. If I just say echo $prop_desc, then it works fine, but doesn't look nice. When I put in $prop = substr($prop_desc, 0, 150); and echo "$prop<br />"; then it returns nothing. Any thoughts anyone? I think this is the last thing I need to finish this project. Thank you so much in advance for ANY suggestions / advice!
  24. My apologies. The newbieness prevents me from knowing what is too little to copy vs too much. This is the query part of the code: $query = "SELECT * FROM GFF WHERE featured_site = 'yes'"; $result = mysql_query($query) or die ("Couldnt execute query"); I did copy / paste what you suggested, but it still didn't return any images. This was the original code and the page is at www.fatcreative.com/GFF: <?php echo "<table cellspacing=\"15\">\n"; while($row = mysql_fetch_assoc($result)) { extract($row); echo "<tr><td>"; echo "<img src=\"$showcase_image\" width=\"100\" height=\"100\" align=\"middle\" >"; echo " $prop_title<br />"; echo "$prop_desc<br />"; echo "<a href=\"showdetails.php?id_number=$id_number\"><div align=\"right\">View Details</div></a>"; echo "</td></tr>\n"; } echo "</table>\n"; ?> I just can't see why this isn't working. Thank you again very much for any suggestions!
  25. I am trying to call in image from my database and it's just not working. I get no image. My page is at www.FatCreative.com/GFF and the images that aren't displaying are at the bottom of the page. When I code the name of the image, it works fine, but when I try to change the image name to the variable, I get a blank box. I'm sure it's something so simple. I've had tried dozens of different variations and I am either getting nothing or an error message. I have confirmed the variable name is showcase_image all lowercase. This is my code: echo "<table cellspacing=\"15\">\n"; while($row = mysql_fetch_assoc($result)) { extract($row); echo "<tr><td>"; echo "<img src=\"$showcase_image\" width=\"100\" height=\"100\" align=\"middle\" >"; echo " $prop_title<br />"; echo "$prop_desc<br />"; echo "<a href=\"showdetails.php?id_number=$id_number\"><div align=\"right\">View Details</div></a>"; echo "</td></tr>\n"; } echo "</table>\n"; Does anyone have any ideas? I am just learning PHP (and loving it!) but some of these things are so frustrating.
×
×
  • 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.