Jump to content

Ninjakreborn

Members
  • Posts

    3,922
  • Joined

  • Last visited

Everything posted by Ninjakreborn

  1. I fully understand what the term "integration" means when it is speaking of web programming, and integrating third party scripts, and things of that nature. However I am having a difficult time actually putting the definition in words, just looking for some inspiration.
  2. Also the main template you see, that isn't a template from somewhere else, it's what I named hte main file. I called it maintemplate.php and maintemplate.css so I could copy and paste it's contents after creation to make the other pages.
  3. uhh, I didn't ask for a re-critique, this post set here for almost 2 week's, without me saying anything, and all of a sudden people started critiquing again, I didn't just pop in and ask. I was actually doing a lot on my server, while keeping an eye on this post, but my last post on this specific thread was over 3-4-5 weeks ago, it died, then people resurrected it. I wasn't asking for help agian, but it's appreciated. Currently I am doing a lot, right now I have changed over to another server, I am "considering", a brand new domain name and website, if I keep the current one, I am going over the entire list I saw from steelman, and going to bite the bullet and follow all or most of his advice, then see how it looks and go over what redbullmarky said. If I don't rebuild the entire thing from scratch, I am atleast going to be rewritting all the code, to these people's advice, and redoing all the content.  A few things steelman mentioned I might not do, but most of the things he said on the design, and a lot of the things he mentioned on the content made since, so I am going to be redoing all of that, based on his ideas, as soon as I decide whether I am scraping and rebuilding under a different domain name, or keeping the current site.
  4. Thanks obsidian, I just threw the onmouseout, on each and every dynamic link and it worked perfectly, because some of this pages loads slowly, it didn't work the way it should 100% but well enough for him to style it, thanks.
  5. Can you give me an example, when I do it with css it just messes it up, when it does it in javascript, it doens't seem to work, I don't know what to do, it took me 3 hours just to create this, I have javascript, any advice?
  6. Thanks, I just got the thing working, but there is a severe problem. Here is what I have. [code]<table class="menu_table"> <tr> <td class="menu_cell"><a href="whois.php"><img src="images/menu/1_whoisOHB.gif" class="noborder" alt="Who is Oakley Home Builders?" /></a></td> <td class="menu_cell"><a href="design.php"><img src="images/menu/2_design.gif" class="noborder" alt="Design Your Dream Home" /></a></td> <td class="menu_cell"><a href="homes_for_sale.php"><img src="images/menu/3_homes-for-sale.gif" class="noborder" alt="Homes for Sale - Chicago Suburbs" /></a></td> <td class="menu_cell"><a href="portfolio.php" onmouseover="document.getElementById('propertysubmenu').style.display='block';" onmouseout="document.getElementById('propertysubmenu').style.display='none';"><img src="images/menu/4_portfolio.gif" class="noborder" alt="Portfolio of Homes - Westmont, Downers Grove" /></a></td> <td class="menu_cell"><a href="testimonials.php"><img src="images/menu/5_customers.gif" class="noborder" alt="Customer Testimonials" /></a></td> <td class="menu_cell"><a href="newsletter.php"><img src="images/menu/6_newsletter.gif" class="noborder" alt="Oakley Home Builders Newsletter" /></a></td> <td width="3px"></td> <td class="menu_cell"><a href="contact.php"><img src="images/menu/7_contact.gif" class="noborder" alt="Contact Oakley Home Builders" /></a></td> </tr> <tr> <td class="menu_cell"></td> <td class="menu_cell"></td> <td class="menu_cell"></td> <td class="menu_cell"> <div id="propertysubmenu"> <?php $selecttemp = "SELECT * FROM oak_properties"; $querytemp = mysql_query($selecttemp); while ($rowtemp = mysql_fetch_array($querytemp)) { echo "<a href=\"property.php?pid={$rowtemp[propertynumber]}\">{$rowtemp[address1]}</a><br />\n"; } ?> </div> </td> <td class="menu_cell"></td> <td class="menu_cell"></td> <td width="3px"></td> <td class="menu_cell"></td> </tr> </table> [/code] [code]<body class="normal" onload="document.getElementById('propertysubmenu').style.display='none';">[/code] The body code makes it hide at load, and the upper one does the hide and display, however there is a problem. http://www.s162063332.onlinehome.us/oakley/property.php?pid=3 Here you will see, unfortunately, it doesn't work right, can you help me figure out how to get it to work right, it makes it to where you can't go downwards to select the other links, it "looks" shitty, because he is going back to style it later, but I just needed a skeleton now, but it's not even functional, that part works, but you can't even go down to a link and click it easily, you have to play with it a few minutes before it let's you click one, instead of working like some of the other's work. Any advice on how I can get it working would be greatly appreciated.
  7. I can't believe this, 3 wasted hours, on javascript again. It's not working, all I want to do is make a div go invisible onload. document.onLoad.getElementById("propertysubmenu").style.visibility.hidden; I have tried that, and everything, I tried document.getElementById("propertysubmenu").style.visibility = "hidden"; = "hide" document.onLoad with the rest, I have tried everything, triple and quadruple checked my syntax, triying to make absolutely sure, this is the same syntax, I found on ton's of site's, adn the same syntax I used before, what's going on. I am trying to make a drop down menu, simply make it disappear onload, and make it reappear on, on mouse over, but nothign is working, I really don't get it, any advice. I know the id is there, it's right here. [code]<table class="menu_table"> <tr> <td class="menu_cell"><a href="whois.php"><img src="images/menu/1_whoisOHB.gif" class="noborder" alt="Who is Oakley Home Builders?" /></a></td> <td class="menu_cell"><a href="design.php"><img src="images/menu/2_design.gif" class="noborder" alt="Design Your Dream Home" /></a></td> <td class="menu_cell"><a href="homes_for_sale.php"><img src="images/menu/3_homes-for-sale.gif" class="noborder" alt="Homes for Sale - Chicago Suburbs" /></a></td> <td class="menu_cell"><a href="portfolio.php"><img src="images/menu/4_portfolio.gif" class="noborder" alt="Portfolio of Homes - Westmont, Downers Grove" /></a></td> <td class="menu_cell"><a href="testimonials.php"><img src="images/menu/5_customers.gif" class="noborder" alt="Customer Testimonials" /></a></td> <td class="menu_cell"><a href="newsletter.php"><img src="images/menu/6_newsletter.gif" class="noborder" alt="Oakley Home Builders Newsletter" /></a></td> <td width="3px"></td> <td class="menu_cell"><a href="contact.php"><img src="images/menu/7_contact.gif" class="noborder" alt="Contact Oakley Home Builders" /></a></td> </tr> <tr> <td class="menu_cell"></td> <td class="menu_cell"></td> <td class="menu_cell"></td> <td class="menu_cell"> <div id="propertysubmenu"> <a href="temp">Temp</a> <a href="temp2">Temp 2</a> </div> </td> <td class="menu_cell"></td> <td class="menu_cell"></td> <td width="3px"></td> <td class="menu_cell"></td> </tr> </table> [/code] It was someone elses menu that is why it's in tables, but I have the div there, it should disappear, I really don't understand it, any advice would be greatly appreciated, I needed to finish this before he started to work on the site, which is 30 minutes, I don't understand why it's not working.
  8. Ok I have to move my database to another server. I went into mysql to get a dump, and it locked up. I had to wait until someone at bluehost could actually go in and back it up for me. They did that, and I see it's 25.5 megabyte .sql file, I can't even seem to open the damn thing on my computer. Much less export it over to the sql, so I finally get it opened, and when I try to paste a little sql at a time into the sql box for the other server, it starts telling me, improper syntax, can someone please help me figure out how to get it from that database to me new database, on my new server.
  9. Why, I understand where the problem's could arrise. But, it the database it defaults over to not set, that way it's just ignored in the ordering process, I need a way to be able to order the one's with the higher numbers before the lower numbers, but any "not set" will just be set at the bottom, in any random order. This was the point of varchar whatever, it is set to default at notset that way it knows they haven't chosen a number, I figured those get pushed at the bottom, the one's they do set, will have a number, so it can order it by that number, unless it will work out properly if they are all a number but default to 0 or something, I don'tk now, any advice?
  10. Now it make's a lot more sense. I will do some more checking on the different uses, thanks, I appreciate it. I will try this out, if everything run's smoothly i will mark it as solved, if not I will ask other questions in this same post.
  11. Thanks I will go over these 2 ideas, and let you know how It went. or ask more questions. I won't say I don't know anything about what I am doing, I will say, that at this moment, I use to do everything the long, and hard way. For the past few "weeks" only I have started really getting more into Array's, Function's, File handling those 3 things I wasn't very good at, so whenenever I encounter them (lately I force myself to use them), I make it a learning experience and work through it, I had forgotten foreach needed a key, because for some reason, lalely without the extra part, all the other things I was trying to do with an array, worked with foreach, just using foreach ($array as $val) or whatever, they were working exactly as expected, so I had forgotten that was needed. EDIT - again it didn't let me post for a minute, so here is an update It worked, the first thing you gave me, (Jocka) thank you, and roopurt thanks for the advice, I will let you know how the rest of it works out, and if it all works out from here, I will mark it as solved. Also the ++ thinga t the bottom was required for it to work, it broke when I took that out, I am working up the rest, and I will tell you how it goes, and marked as solved if it all works out properly.
  12. [quote]I'm guessing that you're intending for your ID and Order arrays to be arrays of single valued entities and not arrays of arrays.  The problem is that the ID and Order arrays themselves contain arrays. Code: foreach ($id as $var1) { $update[$var1] = "UPDATE oak_images SET order = '" . $order . "' WHERE id = '" . $var1 . "';"; } The fact that $id contains arrays means that $var1 is an array.  The error you're getting is stating that your offset into the $update array is illegal, in this case it's an array. Your code is essentially doing this, and it's illegal:[/quote] I am a little confused, I thought that id was an array, and so was order I thought the id array, contained all the id's. of course it has it's generated key's, but then the id's I thought the same for order, I am  missing something, and getting confused? $update[Array(1,2,3,4)] = "some sql statement";
  13. Ok, as far as data in the table. It's a database that was already finished, and this is just a feature I am building in, the person is wanting to be able to sort images. I constructed the backend to the site in a week, now I am just helping my graphic designer, by oding some new features into backend, well all are done, but this. He said theyw anted to be able to sort there image.s I didn't want a lot of hastle, so I created 1 extra field in the images table called order varchar, whatever it nulls to not set or something, so at the beginning I don't accept an order number, that way I didn't have to touch the script that they originally add images with. Now, I am at the editing page, I have a form, here is the form. [code]<?php require_once("../master/config/config.php"); ?> <?php // This page below get's a little hairy if ($_SESSION['controller'] == true) { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <?php include($docroot . "/master/includes/meta.inc.php"); ?> </head> <body id="adminbody"> <?php // include administration header include($docroot . "/master/includes/header.admin.inc.php"); ?> <?php // include administration left navigation include($docroot . "/master/includes/leftnav.admin.inc.php"); ?> <div id="adminrightcolumn"> <h1>Edit Image Information</h1> <p>Below you will find a list of every image associated with this property.  You will also (below each image) see the status, whether it's enabled or disabled.  THe final 2 things you will see (below enabled information) is a link to either delete that image, or disable that image.  Please note if a property is disabled/deleted all image's associated with that property are deleted/disabled respectively as well.  Please also note, that the text field is the sort order.</p> <hr /> <?php $id = mysql_real_escape_string($_GET['id']); $property = "SELECT address1 FROM oak_properties WHERE propertynumber = '$id';"; $prop_query = mysql_query($property); while ($prop_row = mysql_fetch_array($prop_query)) { echo "<h1>{$prop_row['address1']}</h1>"; } $select = "SELECT * FROM oak_images WHERE propertynumber = '$id';"; $query = mysql_query($select); echo '<form name="form1" id="form1" action="imagesort.php" method="post" />'; while ($row = mysql_fetch_array($query)) { echo "<div id=\"adminimages\">\n"; $height = "height=\"100px\""; $width = "width=\"100px\""; echo "<img src=\"/oakley/{$row[pathtofile]}{$row[filename]}\" alt=\"{$row[filename]}\" {$height} {$width} /><br /><br />"; if ($row['enabled'] == "yes") { echo "<a href=\"disableimage.php?id={$row[imageid]}\" title=\"Disable Image\">Disable</a>\n"; }elseif ($row['enabled'] == "no") { echo "<a href=\"enableimage.php?id={$row[imageid]}&prop={$row[propertynumber]}\" title=\"Enable Image\">Enable</a>\n"; } echo "<br />"; if ($row['featured'] == "no") { echo "<a href=\"featureimage.php?id={$row[imageid]}&prop={$row[propertynumber]}\" title=\"Feature Image\">Make Featured</a>\n"; }elseif ($row['featured'] == "yes") { echo "Featured Image\n"; } echo "<br />"; echo "<a href=\"deleteimage.php?id={$row[imageid]}\" title=\"Delete Image\">Delete</a>\n"; echo "<br />"; echo "<input name=\"id[]\" type=\"hidden\" value=\"{$row[imageid]}\" />\n"; echo "<input name=\"order[]\" type=\"text\" value=\"{$row[order]}\" size=\"5\" />\n"; echo "<br /></div>\n"; } echo '<input name="check" id="check" type="hidden" value="yes" />' . "\n"; echo "<input name=\"submit\" id=\"submit\" type=\"submit\" value=\"change sort order\" />"; echo "</form>\n"; ?> <hr /> </div> </body> </html> <?php } ?>[/code] The only things I did to that page, to add this new feature, was wrap the dynamic display of images in form tag's, and dynamically create input fields to retrieve the id, and order input. THey can put in a number, but they don't have to put them all in, since later, all I will do, is order the queries by order number, so the first numbers will get displayed first. IT's cheap, but it's what they wanted, they just wanted something basic, say, hey I want this image to appear "before" this one, so I put a a number on this one lower than the other, and they will retain that order. That is the point of this whole thing, so I bring those 2 things over the id, and order, and I was thinking of constructing one update array for each one, and running that array through a foreach to do mysql queries on each one. This is the only idea I came up with, since an update query can only relaly update 1 row, if you need to update different things, (in this situation updating different id's, with the new order value), then I was thinking seperate queries That is a breakdown of hte whole situation.
  14. After playing with it awhile I got this. [code]<?php require_once("../master/config/config.php"); ?> <?php // This page below get's a little hairy if ($_SESSION['controller'] == true) { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <?php include($docroot . "/master/includes/meta.inc.php"); ?> </head> <body id="adminbody"> <?php // include administration header include($docroot . "/master/includes/header.admin.inc.php"); ?> <?php // include administration left navigation include($docroot . "/master/includes/leftnav.admin.inc.php"); ?> <div id="adminrightcolumn"> <h1>Change Image Sort Order</h1> <?php if ($_POST['check'] == "yes") { $id = array($_POST['id']); $order = array($_POST['order']); $update = array(); foreach ($id as $var1) { $update[$var1] = "UPDATE oak_images SET order = '" . $order . "' WHERE id = '" . $var1 . "';"; } echo "ID Array:"; echo "<br />"; dumparray($id); echo "<br />"; echo "Order Array:"; echo "<br />"; dumparray($order); echo "<br />"; echo "Update Array:"; echo "<br />"; dumparray($update); echo "<br />"; } ?> </div> </body> </html> <?php } ?>[/code] However it's still not coming even close, here is what it's outputting when I use the above code. [quote]Change Image Sort Order Warning: Illegal offset type in /homepages/30/d162063315/htdocs/oakley/admin/imagesort.php on line 32 ID Array: Array (     [0] => Array         (             [0] => 72             [1] => 66             [2] => 67             [3] => 68             [4] => 69             [5] => 70             [6] => 71             [7] => 73             [8] => 74             [9] => 75             [10] => 76             [11] => 77             [12] => 78             [13] => 79             [14] => 80             [15] => 81             [16] => 82             [17] => 83             [18] => 84             [19] => 85             [20] => 86             [21] => 87         ) ) Order Array: Array (     [0] => Array         (             [0] => 0             [1] => 0             [2] => 0             [3] => 0             [4] => 0             [5] => 0             [6] => 0             [7] => 0             [8] => 0             [9] => 0             [10] => 0             [11] => 0             [12] => 0             [13] => 0             [14] => 0             [15] => 0             [16] => 0             [17] => 0             [18] => 0             [19] => 0             [20] => 0             [21] => 0         ) ) Update Array: Array ( ) [/quote] I am still working with it, but so far I got it to atleast register the id array, and order array. Now I have to figure out how to put them together, to form the update queries, and then I want to create the $update array to store each query, then I can cycle through each one of those in that array, and perform a query on each one of them. However I am having a hard time, getting it to save the update information into an array, and when it does echo the array, alll it's saying is the array name instead of the values Like, it only records one occurence in the update array and it's something like $update = "UPDATE oak_images SET order = 'array' WHERE id = 'array';": any advice ,on helping me make progress would be greatly appreciated. EDIT- Making progress, I just found out how to get array's to work like that, but now, when trying to construct my array, it's not working well, it's still only creating one array variable, which is one update query, that isbroken because it says array, instead of id, and order.
  15. I was trying to construct a query. I have a group of image's, I am needing to change the sort order of the image's dynamically from a dynamically created form. I have ran through a few ideas' but nothing is substantial, [code]<?php require_once("../master/config/config.php"); ?> <?php // This page below get's a little hairy if ($_SESSION['controller'] == true) { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <?php include($docroot . "/master/includes/meta.inc.php"); ?> </head> <body id="adminbody"> <?php // include administration header include($docroot . "/master/includes/header.admin.inc.php"); ?> <?php // include administration left navigation include($docroot . "/master/includes/leftnav.admin.inc.php"); ?> <div id="adminrightcolumn"> <h1>Change Image Sort Order</h1> <?php if ($_POST['check'] == "yes") { $id = array($_POST['id']); $order = array($_POST['order']); $update = "UPDATE oak_images SET "; foreach ($id as $var1) { $update .= "order = } dumparray($id); echo "<br />"; dumparray($order); } ?> </div> </body> </html> <?php } ?>[/code] You see here I got stuck in mid thought, what is a good way to go about doing this. I need it to go through each id, and set the order number to the order number they choose, one's that were blank, in the database, will be automatically set to not-set.  From default at the beginning, I just need it to go through and update all the image information in teh forms, to change the order numbers to the set one's. Since there all different id's don't i need to let it construct one query for each image, which will be pretty easy, but that could end up sometime's being 20-30 different update queries, depending on how many images where changed. Any advicewould be appreciated, mostly int he best way to go about doing this, or should i just let it write a new update query for each individual id number.
  16. Ok thanks for the help, can you also explain one last thing the return true, return false, I know it plays a big part in javascript functions, but where does it come into play here in php functions. When is it needed to be used, when not to use it, what they are really for? Is it strictly to be used when you need the function to return some form of true or false, like if you are testing whether the funciton was true or false to do something else, that sounds like the only logical situation in which to use return true, or return false, or is there something I am missing.
  17. do some googling for alternatives, something like "paypal web payments PRO alternatives" "paypal web payments PRO canada alternatives" "paypal web payments PRO canadian services" things like that, see what kind of things you can uncover by doing some studying on it, find out what the general name for that "type" of service is, and see if you can uncover some canadian alternatives, that are free, and open source, you never know what you can find, by doing a little digging. Sometimes the best site's aren't number one in google, and it work's if you sometime's go to the 50-100th page, sometimes you find stuff that work's better than the first couple of pages.  Maybe one's just starting out, with not a lot of ranking's or traffic.
  18. [quote]some people will study and study for years (no names mentioned) and still be stuck in a hole.[/quote] I see, very funny.
  19. Data harvesting off of a site, or look around for live xml feed's, or something similar.  OR sql dumps, and then you can get those regular and have you program chop it up and database it, there are lot's of alternatives, you can find a site, I Don't believe in data harvesting on private information, but I feel there is nothing wrong with it on public information, and you can easily find that in public information, even if it is from multiple sources, espn, or something similar might be a good choice. But also (personal preference), I don't like any sports but video game wrestling, so that's about all the help I can offer.
  20. I am obsessed with custom programming, I do 70-90% of everythign I do 100% custom from scratch, but after lot's of thinking, I know of one function that is universal, that validates teh credit card number, but to actual be able to do the physical processing, it's best to use a service, unless you want to do them all manually. Plus there are lot's of legal concerns related to storing credit card number's, and other related information in a local database. I was told this by someone here on phpfreaks, and when I checked it, you can get severe suit damages if someone hacked your database, you need a top of the line secure system to be able to do something like that, which is above that of even small businesses, that would be something for huge, mega million dollar businesses.  Paypal would be a good alternative, because people can use there credit cards/debit cards (through) the paypal system if they wanted.
  21. [code] <?php // Function: function validateemail($email) { global $errorhandler; // set regular expression to test email if ($email == "") { $errorhandler .= "The email address was left blank.<br />"; } $regexemail = "^[A-Za-z0-9\._-]+@([A-Za-z0-9][A-Za-z0-9-]{1,62})(\.[A-Za-z][A-Za-z0-9-]{1,62})+$"; if (!ereg("$regexemail", $email)) {  // test for formatting $errorhandler .= "The email address is improperly formatted<br />"; } // test email domain name for existence if(!(getmxrr(substr(strstr($email, '@'), 1), $temp)) || checkdnsrr(gethostbyname(substr(strstr($email, '@'), 1)), "ANY")) { $errorhandler .= "The Domain name for the email address does not exist<br />"; } } // End function ?> [/code] Ok it worked, I had misunderstood about the global, so this time I tried it inside the function itself, and it work's. If you have time can you still answer those question's, because I am very confused as to why it didn't work, and why the global was required, and it worked without the return true's, and false's I am a little confused here, thanks for all the help so far.
  22. [quote]right after you start that function, try adding this: global $errorhandler; Also, you always want to return the function either true or false. So if the email doesn't validate (in any of those if statements) then do return false; And then under all the if statements put return true; . That tells the function that everything went ok.[/quote] Ok now I have a couple of questions. 1. I see that the global was something I forgot, in what situations do I need this, in which one's do I not need it.  If I need it then I will always use it, but do I need to make any I understand what global is for, I know how it's used, but I don't understand when to use it and when not to. For instance [code]<?php function errorhandler($errorhandler, $url) { if ($errorhandler != "") { echo "<span style=\"color:red\">"; echo $errorhandler; if ($url != "no") { echo $url; } echo "</span>"; } } ?>[/code] Ok here is hte thing with this function, I create the url variable before it, and then I pass the function the errorhandler and the url variable. Now I don't use global on either one of these, but it works fine. Other functions seem to work like this similarly, so when does the global have an affect on it, for whether it works or not.  SO you see why I would have wonderings about this. 2.  I understnad return true; and return false; but that's primarily from javascript. I always did php programming, without functions until not to very long ago, so I am hazy on the return true, return false. When I see return true, then I normally recall it returning the function as false, as the function itself failed. Like the mail function it returns false if it fails, and true if it succeed's, that's it. That function I have above, the one with the email's, it's not really suppose to return whether the function worked or not, if it run's into an error it's just suppose to append the specific error into the error handler, and after the function is totally ran through, it continues on with the rest of the script doing other form's of error handling. Can you explain (in this situation), what the different would be in having the return false, and return true in those locations, would differ from not having them there (I am asking for learning purposes) That should answer all my questions. Does anyone also have any advice on why the mail on form2.php is not sending, the other's are, but that isn't. Now thnanks Jocka for all the help so far, I have read tutorials, and ton's of books on functions before coming over to them, I guess there were just a few things I didn't understand, I am trying to get them down very well, then moving over into object oriented programming, but I have to have a full understanding of all concepts behind functions, and have used them awhile before I can move into that. Any more advice, or answers would be appreciated. MAJOR EDIT - Above was my original message, and it wouldn't let me post then, and kept me from the site for a few minutes, so a few things have changed on this, 1. The form finally sent me emails, I think it was my email provider going slow. 2. The Function, I went ahead and tried everything you said, the global, the return true's, and false's, and everything, but nothing made it work, I tried all combinations with the 2 things you said, but it's still not reading the function. Everything is working, but with this function broke (it being in my framework), then all 3 of the forms are not working (the email validation part), I could just go ahead and pull the stuff into the file's and do it the way I use to without functions, but i know this is something I am doing wrong, and something I would like to learn from. Any help, or answers to those first couple of questions, I would greatly appreciate it.
  23. I was helping a graphic designer on something, I was just building a basic form (no real styling) Normally everything goes smoothly, I built 2 for him and everything, seemed to work fine. form2.php [code]<?php require_once($docroot . "master/config/config.php"); ?> <form action="form2processor.php" method="post" name="inputform" onsubmit="return checkFields()"> <label for="firstname"><b>First Name</b></label><br /> <input type="text" name="firstname" size="30" maxlength="255" value="<?php echo stripslashes($_GET['firstname']); ?>" /><br /> <label for="lastname"><b>Last Name</b></label> <br /> <input type="text" name="lastname" size="30" maxlength="255" value="<?php echo stripslashes($_GET['lastname']); ?>" /><br /> <label for="telephone"><b>Telephone</b></label> <br /> <input type="text" name="telephone" size="30" maxlength="255" value="<?php echo stripslashes($_GET['telephone']); ?>" /><br /> <label for="email"><b>Email Address</b></label><br /> <input type="text" name="email" size="30" maxlength="255" value="<?php echo stripslashes($_GET['email']); ?>" /><br /> <label for="pricerange">Price Range:</label><br /> <select name="pricerange"> <option selected="selected">Select one...</option> <option value="Less than $500,000">Less than $500,000</option> <option value="$500,000 to $600,000">$500,000 to $600,000</option> <option value="$600,000 to $700,000">$600,000 to $700,000</option> <option value="$700,000 to $800,000">$700,000 to $800,000</option> <option value="$800,000 plus">$800,000 plus</option> </select><br /> <label for="movedate">Move Date:</label><br /> <select name="Movedate"> <option selected="selected">Select one...</option> <option value="Less than 3 Months">Less than 3 Months</option> <option value="3 to 6 Months">3 to 6 Months</option> <option value="6 to 9 Months">6 to 9 Months</option> <option value="9 Months to 1 Year">9 Months to 1 Year</option> <option value="1 Year or More">1 Year or More</option> </select><br /> <label for="squarefoot">Approximate Square Foot:</label><br /> <select name="squarefoot" id="squarefoot"> <option value="up to 2500 Sq Ft">up to 2500 Sq Ft</option> <option value="2500 to 3000">2500 to 3000</option> <option value="3000 to 3500">300 to 3500</option> <option value="3500 to 4000">3500 to 4000</option> <option value="4000+">4000+</option> </select><br /> <label for="sidingmaterial">Siding Material:</label><br /> <select name="sidingmaterial" id="sidingmaterial"> <option value="Brick">Brick</option> <option value="Stone">Stone</option> <option value="Hardie">Hardie</option> <option value="Cedar">Cedar</option> <option value="Vinyl">Vinyl</option> </select><br /> <?php select("granitekitchen", "Granite Kitchen", "Yes"); select("stainlesssteelappliances", "Stainless Steel Appliances", "Yes"); select("highceilings", "High Ceilings", "Yes"); select("openfloorplan", "Open Floor Plan", "Yes"); select("cargarage_2", "2 Car Garage", "Yes"); select("cargarage_3", "3 Car Garage", "Yes"); select("doublelevelfoyer", "Double Level Foyer", "Yes"); select("hardwoodfloors", "Hardwood Floors", "Yes"); select("marblebaths", "Marble Baths", "Yes"); ?> <label for="comments"><b>What may I help you with?</b></label><br /> <input type="text" name="comments" size="30" maxlength="255" value="<?php echo stripslashes($_GET['message']); ?>" /><br /> <input name="submit" type="submit" value="submit"><br /> [/code] Processor [code]<?php require_once($docroot . "master/config/config.php"); ?> <?php if (isset($_POST['submit'])) { $errorhandler = ""; validateemail($_POST['email']); if ($_POST['firstname'] == "") { $errorhandler .= "First Name was left blank.<br />"; } if ($_POST['lastname'] == "") { $errorhandler .= "Last Name was left blank.<br />"; } if ($_POST['telephone'] == "") { $errorhandler .= "Telephone was left blank.<br />"; } $url = "<a href=\"form2.php?firstname={$_POST[firstname]}&lastname={$_POST[lastname]}&telephone={$_POST[telephone]}&email={$_POST[email]}&comments={$_POST[comments]}\" title=\"Fix Errors\">Fix Errors</a>"; errorhandler($errorhandler, $url); if ($errorhandler == "") { $subject = "Schedule A Personalized Showing Form Response"; $firstname = stripslashes($_POST['firstname']); $lastname = stripslashes($_POST['lastname']); $telephone = stripslashes($_POST['telephone']); $comments = stripslashes($_POST['comments']); $pricerange = stripslashes($_POST['pricerange']); $movedate = stripslashes($_POST['movedate']); $squarefoot = stripslashes($_POST['squarefoot']); $sidingmaterial = stripslashes($_POST['squarefoot']); $granitekitchen = stripslashes($_POST['granitekitchen']); if ($granitekitchen != "Yes") { $granitekitchen = "No"; } $stainlesssteelappliances = stripslashes($_POST['stainlesssteelappliances']); if ($stainlesssteelappliances != "Yes") { $stainlesssteelappliances = "No"; } $highceilings = stripslashes($_POST['highceilings']); if ($highceilings != "Yes") { $highceilings = "No"; } $openfloorplan = stripslashes($_POST['openfloorplan']); if ($openfloorplan != "Yes") { $openfloorplan = "No"; } $cargarage_2 = stripslashes($_POST['cargarage_2']); if ($cargarage_2 != "Yes") { $cargarage_2 = "No"; } $cargarage_3 = stripslashes($_POST['cargarage_3']); if ($cargarage_3 != "Yes") { $cargarage_3 = "No"; } $doublelevelfoyer = stripslashes($_POST['doublelevelfoyer']); if ($doublelevelfoyer != "Yes") { $doublelevelfoyer = "No"; } $hardwoodfloors = stripslashes($_POST['hardwoodfloors']); if ($doublelevelfoyer != "Yes") { $doublelevelfoyer = "No"; } $marblebaths = stripslashes($_POST['marblebaths']); if ($marblebaths != "Yes") { $marblebaths = "No"; } $emailmessage = " First Name: {$firstname} Last Name: {$lastname} Telephone: {$telephone} Price Range: {$pricerange} Move Date: {$movedate} Square Foot: {$squarefoot} Siding Material: {$sidingmaterial} The following they selected as applies: Granite Kitchen: {$granitekitchen} Stainless Steel Appliances: {$stainlesssteelappliances} High Ceilings: {$highceilings} Open Floor Plan: {$openfloorplan} 2 Car Garage: {$cargarage_2} 3 Car Garage: {$cargarage_3} Double Level Foyer: {$doublelevelfoyer} Hardwood Floors: {$hardwoodfloors} Marble Baths: {$marblebaths} Comments: {$comments} "; if (mail($contactemail, $subject, $emailmessage)) { echo "We have recieved your message, we will contact you within the next 48 hours.<br />"; }else { echo "There was a problem sending the contact emaill, please try again.<br />"; } } } ?> [/code] Now my other processors are working fine, but I noticed a few things on form2.php I made about 3 forms for him and the other's worked.  Now this form has 2 issue's, and one of the issues is also present on the other 2 forms. I could just do it the standard way, but it's something wrong I am doing with a function. The function is [code]<?php function validateemail($email) { // set regular expression to test email if ($email == "") { $errorhandler .= "The email address was left blank.<br />"; } $regexemail = "^[A-Za-z0-9\._-]+@([A-Za-z0-9][A-Za-z0-9-]{1,62})(\.[A-Za-z][A-Za-z0-9-]{1,62})+$"; if (!ereg("$regexemail", $emailaddress)) {  // test for formatting $errorhandler .= "The email address is improperly formatted<br />"; } // test email domain name for existence if(!(getmxrr(substr(strstr($emailaddress, '@'), 1), $temp)) || checkdnsrr(gethostbyname(substr(strstr($emailaddress, '@'), 1)), "ANY")) { $errorhandler .= "The Domain name for the email address does not exist<br />"; } } ?>[/code] Now you can see throughout form2.php where I called the function in the processor. Now other functions are working just fine, it's only this one. In my scripts I initialize a blank variable $errorhandler Then I append things to the string as errors occur, I created this function to hopefully deal with everything related to emails more quickly (I even tried in the function putting return $errorhandler;, however it had no effects positively or negatively.)  As of right now it's not working on any of them, so it's obvious it's the function can someone help me figure out why it's not reading my function at all.  It's not even giving me function not declared, it's just simply not doing anything, it can't tell when the email isn't filled in, it ignores it all together. Now the other problem is Form2.php is not sending me an email, at all.  The other 2 form's, are sending the email, and it's coming to my box, but for some wierd reason this other form2.php is not wanting to send it, no matter how many time's I try I fought with both of these issues for awhile, with no luck, any advice would be greatly appreciated.
×
×
  • 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.