Jump to content

Ninjakreborn

Members
  • Posts

    3,922
  • Joined

  • Last visited

Everything posted by Ninjakreborn

  1. ok maybe my other post was too run down, and not clear enough to get answers from, so I decided to repost with some clear questions. I tried running one single post forever, with all the questions I ever had, but it may not work. I am working on a process, I am trying to master the art of getting form information sent via email. Then I will work on simple validation with both php and javascript. Then intermediate and advanced forms of validation. I have been working with getting the information sent via email but a few things are throwing me off. 1. The main thing is the fact of setting elements as an array. I have all the elements working right, even the drop down select menu, and radio buttons work. But the checkboxes, it only registers one choice, I know to set the names with name[] and then set each value as something. I was told how to pass it into an array and redisplay the information on the screen, but I need to set it up as an array and get it to email me the answers that were chosen, I even learned how to format the information so the email looks nice and everything< i can't avoid this element as when I start doing jobs of course most forms I run across will have checkboxes. 2. Another important thing I don't understand is this, I use the following code to process my form, and it worked fine except for the check boxes [code] <?php $to = "businessman332211@hotmail.com"; $subject = "freelance businessman!"; $body = " First Name:$firstname Last Name:$lastname Age: $age Location: $location Favorites: $favorites Choices: $choices Username: $username Verify Username: $verifyusername Password: $password Verify Password: $verifypassword"; if (mail($to, $subject, $body)) {   echo("<p>Message successfully sent!</p>"); } else {   echo("<p>Message delivery failed...</p>"); } ?> [/code] ok that got it processed alright and emialed to me in the correct format, I can do this with anyform now taht I mastered this part of php. but what I don't get is some people do things like this. [code] <?php     $_GET['Languages'] = implode(', ', $_GET['Languages']);     $_GET['Story'] = str_replace("\n", "<BR />", $_GET['Story']);     print "Your name: {$_GET['Name']}<BR />";     print "Your password: {$_GET['Password']}<BR />";     print "Your age: {$_GET['Age']}<BR /><BR />";     print "Your life story:<BR />{$_GET['Story']}<BR /><BR />";     print "Your favourite sport: {$_GET['FaveSport']}<BR />";     print "Languages you chose: {$_GET['Languages']}<BR />"; ?> [/code] I know some of this is pointless, they have all these _GET things and _POST on some, but I don't get why I need that, when I send it in an email I DO NOT use those, and it sends the email, and still registers the variables, they are still accesible without using the get and post before each name, I don't udnerstand this because even people who tried to help me through here always had the _GET, _POST before each variable. 3. Another question I ahve is when I validate with php, should I do it in the external page that I emailed it in, or should I do it on the same page, the javascript I know on the same page, I will set something up, but right now I was concentrating on the emailing Sorry to post again, but I only have those few things holding me back, after I finish working through that then I can move onto validation, but until I get those atleaast first 2 answers figured out I cannot move foward, and this is the only place I can ask at, and I looked everywhere, ALL the websites and tutorials show using _POST, and _GET in front of each one, these are the last 2 thigns I don't understand, and I have to know these before I move onto validation.
  2. ok I tried the following form again [code] <form name="testform" action="formprocessor.php" action="get"> First Name:<input name="firstname" type="text" maxlength="20" /><br /> Last Name:<input name="lastname" type="text" maxlength="20" /><br /> Age:<input name="age" type="text" maxlength="3" /><br /> How you located this Website:<br /> <select name="location"> <option>Search Engine</option> <option>Browsing other</option> <option>freelance businessman</option> <option>You don't want to specify</option> </select> <br /> Pick one of the following:<br /> Video Games:<input name="favorites" type="radio" value="video games" checked="check"/><br /> Tv:<input name="favorites" type="radio" value="tv" /><br /> Nothing:<input name="favorites" type="radio" value="nothing" /><br /> Please check all that apply:<br /> I am comfortable with my surroundings:<input name="choices[]" type="checkbox" value="comfortable" /><br /> I am angered by my surroundings:<input name="choices[]" type="checkbox" value="angered" /> <br /> I am bothered by my surroundings:<input name="choices[]" type="checkbox" value="bothered" /> <br /> I am worthless when people are around:<input name="choices[]" type="checkbox" value="worthless" /> <br /> I am unserious when people are around:<input name="choices[]" type="checkbox" value="unserious" /> <br /> Please choose a proper username:<input name="username" type="text" maxlength="30" /><br /> Please verify your username:<input name="verifyusername" type="text" maxlength="30" /><br /> Please add in your password:<input name="password" type="password" maxlength="25" /><br /> Please verify your password:<input name="verifypassword" type="password" maxlength="25" /><br /> <input name="submit" type="submit" value="submit" /> <input name="reset" type="reset" value="reset" /> Thank you for taking the time to fill out this form, if everything works correctly you will recieve a confirmation stating that it was completed successfully. </form> [/code] I had the drop down menu and radio buttons, they were sending the correct on that was chosen, then I noticed it was only the checkboxes, so I tried an array like this. [code] <?php $choices = array($choices=>$comfortable, $choices=>$angered, $choices=>$bothered, $choices=>$worthless, $choices=>$unserious); $to = "businessman332211@hotmail.com"; $subject = "freelance businessman!"; $body = " First Name:$firstname Last Name:$lastname Age: $age Location: $location Favorites: $favorites Choices: $choices Username: $username Verify Username: $verifyusername Password: $password Verify Password: $verifypassword"; if (mail($to, $subject, $body)) {   echo("<p>Message successfully sent!</p>"); } else {   echo("<p>Message delivery failed...</p>"); } ?> [/code] and like this [code] <?php $choices = array($comfortable, $angered, $bothered, $worthless, $unserious); $to = "businessman332211@hotmail.com"; $subject = "freelance businessman!"; $body = " First Name:$firstname Last Name:$lastname Age: $age Location: $location Favorites: $favorites Choices: $choices Username: $username Verify Username: $verifyusername Password: $password Verify Password: $verifypassword"; if (mail($to, $subject, $body)) {   echo("<p>Message successfully sent!</p>"); } else {   echo("<p>Message delivery failed...</p>"); } ?> [/code] Neither of them worked.
  3. ok I played around with it some and ran into a few problems. When I pass it into an array, how to pass it into an array, and get it to send me all the checked items through the email. I saw a lot of people getting the information variables using stuff like [code] _GET['something']; or _POST['something']; [/code] I am asking these questions because Ididn't find the answers anywhere else. I looked around understood what I could and came here. THe last thing I am trying to figure out, is what is the point of keeping the _GET _post in there, nad what is the difference. Should I always use get, or always use post, or mix them based on the reason if so what reasons.
  4. I still don't understand, how do I draw that information in the select boxes into an array, and set it up to where it can be sent in an email like I did earlier.
  5. I noticed that at the last minute, I put down this at the last minute when I realized I had read it incorrectly. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] ok it sent, I need to work on a few things here. First of all how do I pass the variables of checked boxes into an array, I see what he meant now, because when I tried to send it, it sent, but allchecks didn't come up, it only picked up one of them. Also I noticed a lot of people when they are trying to send it they put $get then wahtever or $post then whatever what's the point of this, I got it to send the other day, do I need to do anything with the $get, $post on the processing page, why didn't I have to to get it to send [/quote]
  6. ok I worked on this along time today< I redid the form completely> but when I added the brackets under the checks it gave me an error someone said to do that into an array, that was confusing so Iput the [] at the end of the choice, but when it tried to process for the form, it just gave me an error and said it could not process the characters []. So I did some tweaking, ran into some errors, fixed some errors in my code. When I got the code right I came up with teh following error. first of all my new form. [code] <form name="testform" action="formprocessor.php" action="post"> First Name:<input name="firstname" type="text" maxlength="20" /><br /> Last Name:<input name="lastname" type="text" maxlength="20" /><br /> Age:<input name="age" type="text" maxlength="3" /><br /> How you located this Website:<br /> <select name="location"> <option>Search Engine</option> <option>Browsing other</option> <option>freelance businessman</option> <option>You don't want to specify</option> </select> <br /> Pick one of the following:<br /> Video Games:<input name="favorites" type="radio" value="video games" checked="check"/><br /> Tv:<input name="favorites" type="radio" value="tv" /><br /> Nothing:<input name="favorites" type="radio" value="nothing" /><br /> Please check all that apply:<br /> I am comfortable with my surroundings:<input name="choices" type="checkbox" value="comfortable" /><br /> I am angered by my surroundings:<input name="choices" type="checkbox" value="angered" /> <br /> I am bothered by my surroundings:<input name="choices" type="checkbox" value="bothered" /> <br /> I am worthless when people are around:<input name="choices" type="checkbox" value="worthless" /> <br /> I am unserious when people are around:<input name="choices" type="checkbox" value="unserious" /> <br /> Please choose a proper username:<input name="username" type="text" maxlength="30" /><br /> Please verify your username:<input name="verifyusername" type="text" maxlength="30" /><br /> Please add in your password:<input name="password" type="password" maxlength="25" /><br /> Please verify your password:<input name="verifypassword" type="password" maxlength="25" /><br /> <input name="submit" type="submit" value="submit" /> <input name="reset" type="reset" value="reset" /> Thank you for taking the time to fill out this form, if everything works correctly you will recieve a confirmation stating that it was completed successfully. </form> [/code] Then here is the php code on the correct page. [code] <?php $recipient = "businessman332211@hotmail.com"; $header = "This is from freelance businessman"; mail($recipient, $header, $firstname, $lastname, $age, $location, $favorites, $choices, $username, $verifyusername, $password, $verifypassword); if(mail($recipient, $header, $firstname, $lastname, $age, $location, $favorites, $choices, $username, $verifyusername, $password, $verifypassword)){ print "The email was sent successfully"; } else { print "the email was not sent correctly"; } ?> [/code] I am now getting the same error I was getting yesterday, I was fiddling around trying to figure out how [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] Warning: mail() expects at most 5 parameters, 12 given in /home/freelan4/public_html/formprocessor.php on line 12 Warning: mail() expects at most 5 parameters, 12 given in /home/freelan4/public_html/formprocessor.php on line 13 the email was not sent correctly [/quote] again there is a lot I want to do before I move onto other things, I want to be able to create any form and process it properly with little to no hasstle. After that I was going to start tackling php validating. and then javascript validating, because I am trying to string everything together so I can master this entire aspect of php programming, I need form advanced down so when I move onto more advanced programming I won't have as hard of a time understanding. Anyadvice on the problems I encountered at this stage would be nice, and someone mentioned passing your checkboxes off as an array, I know what arrays are, but don't understand what setting these up as an array is going to help, I also don't fully understand HOW to pass them off as an array, what would the purpose of this be. I just fixed it nevermind, let me see if I run into any more problems, but I got theemail to send, I misread something someone on here told me but the person when I reread it I reunderstood everything. ok it sent, I need to work on a few things here. First of all how do I pass the variables of checked boxes into an array, I see what he meant now, because when I tried to send it, it sent, but allchecks didn't come up, it only picked up one of them. Also I noticed a lot of people when they are trying to send it they put $get then wahtever or $post then whatever what's the point of this, I got it to send the other day, do I need to do anything with the $get, $post on the processing page, why didn't I have to to get it to send.
  7. i will look at that thanks.
  8. don't I have to pass something to say who to email it to, for instance when I create a form, I am not going to have a field there that says my email address. So how would I set up to be able to email it to me, without having it as a variable in the form.
  9. I can't figure this out, I am just trying to get the basics of sending hte information in an email, much less validation, here for instance is my form that I created to test this out on. [code] <form action="formprocessor.php" method="post" name="testform" id="testform"><br /> First Name:<input name="firstname" type="text" maxlength="20" /><br /> Last Name:<input name="lastname" type="text" maxlength="20" /><br /> Age:<input name="age" type="text" maxlength="3" /><br /> Your Favorite Video Game Genre:<br /> Shooting:<input name="favvids" type="radio" /> Rpg:<input name="favvids" type="radio" /> Strategy:<input name="favvids" type="radio" /> Roleplaying:<input name="favvids" type="radio" /> Simulation:<input name="favvids" type="radio" /><br /> How do you like spending your time the most. <select name="spendingtime"> <option>Sleeping</option> <option>Relaxing</option> <option>Socializing</option> <option>Other</option> </select> <br /> Check All that Apply:<br /> I am well respected:<input name="iam" type="checkbox" /><br /> I am well renowned:<input name="iam" type="checkbox" /><br /> I am very short:<input name="iam" type="checkbox" /><br /> I don't like confrontation<input name="iam" type="checkbox" /><br /> I dislike people talking to me:<input name="iam" type="checkbox" /><br /> <input name="submit" type="submit" value="submit me" /> </form> [/code] Ok Now I tried multiple methods to get this to work right, maybe all the methods aren't good, or this isn't how it should be done or what, but none of them are workign right, much less me getting into client side and server side validation. ok here was the first thing I tried. [code] <?php $recipient = $_POST['businessman332211@hotmail.com']; $subject = $_POST['This is from my site'];    mail($firstname, $lastname, $age, $favvids, $spendingtime, $iam); ?> [/code] I then recieved the following error message [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] Warning: mail() expects at most 5 parameters, 6 given in /home/freelan4/public_html/formprocessor.php on line 11 [/quote] ok so then I changed it to do the following, that doesn't even go to show I have no idea why it told me the mail command can only send 5 things, beats me. [code] <?php $recipient = $_POST['businessman332211@hotmail.com']; $subject = $_POST['This is from my site'];    mail($firstname, $lastname, $age, $favvids, $spendingtime); ?> [/code] ok that took me ahwile to get down, what happened with that is it sent, and just to be safe, I put in the following php if statement to make sure it sent. [code] if (mail($firstname, $lastname, $age, $favvids, $spendingtime)) { print "This email was sent correctly"; } else { print "this email did not send correctly" } [/code] after that I sent it three or 4 times to see if it worked and each time it seemed to come up successful. Now I sit down a long time later and find out that it did not come to my email address. Awhile back I tried something else, but I don't remember what, oh I was just trying to send a basic email, and it sent, but everytime it did(this was without the form by the way just trying to send an email that was it.), and it sent, but I had a major problem and every time it came into my junk mail only. now I am trying to figure out, I want to be able to create any form, get it processed and sent in the email, that is what I am trying to master, along with validating it with javascript properly, and validating it with php also in the external file, but I am running into this major roadblock, I know there are hundreds of ways to do everything in php, but I can't seem to get down even one. Any advice would help.
  10. I need help I can't do this, I have fought with this for days and days. I studied all the basics of php so I know pretty much the basics, 3 weeks so far, and I know quite a bit, ubt I am trying to put all that I know together and get to where after I create a advanced xhtml form, I need to be able to run it to an external php file, and gather the information and send it to myself in an email. and validate it using php and javascript. I worked on this technique for a long time, I decided to validate client side in order to catch some, and have the also validate server side for those people that have javascript turned off. THis is something I read on a few sites as a recommendation, so far I have gotten php to send an email, then I finally get the information and tried to send it, but when it did all the information came back in the email as blank, I did a few modifications use an if mail statement to tell me if it sent, I sent 2 or 3 and the email never even came in, can someone please help me sort through all of this, I have to master this before I can move onto the more advanced thigns.
  11. php as a server side, which is better to use for saving information Mysql database, or xml.
  12. the guy who responded up there is right, that would probably be where you problem is.
  13. not that I know of there is a way to catch the url of where they are coming from, but it comes blank if they typed in the url. You can also tell if they come from a search engine. There could be a way to check the title. I am checking now. [a href=\"http://www.webmasterworld.com/forum88/517.htm\" target=\"_blank\"]http://www.webmasterworld.com/forum88/517.htm[/a] Check this forum here, this has a deep discussion on it,and it tells some about how to get the referrer title, but you have to take the time to look over the whole post, if this doesn't help let me know, and on monday I will create you a script to do it, if it's possible when I start my work schedule, let me know whether this works or not, and wait for me to respond on monday I will post saying I am starting and I will post again with the results. Let me know whether that posts works or not by sometime mid tomorrow, so I have time to finish the script for you.
  14. I know everything in web design has a place. there is one language I was wondering about. xhtml is to create the page. Css is to style the page. Javascript is to add some special functions, and unique actions, php is to dramatize, and make the page dynamic, sql(variations) are to database a website when needed. and add database. IN the general scope of things what would xml be used for. What purposes does it serve, I know at w3 it states it works with the other langues, so I can use Xhtml, css, Php, Sql, javascript, and still have a fundamental purpose for xml to work with all of those, so what would that purpose be and what would be the reason for xml.
  15. that's only with javascript though there are other types of browser side scripting I am not saying it can't be done, just not with javascript. Try www.w3schools.com, over on the left you will see javascript, all those other languages in that section are all browser side scripting languages, check those. If not try php./
  16. By what I have done with javascript, it is probably best if you didn't do that. Javascript isn't secure is any information going through that, and also you have to understand, with javascript no matter what some of your viewers will not have access to that, it is good to not put anything of utmost importance in javascript, as anyone with some older browsers that don't support javascript or if they have it turned off then what you are doing they won't see. Javascript is for preloading images, and dropdown menus with some peolpe that want it, as long as you have other links as well, and javascript isn't picked up in search engines, rethink wwhether you want to do this or not, but what you can do. and unfortunately you can only create 3 types of popup windows, alert, prompt, and another. Its with an ok button, with ok and cancel, and with typing in 1 thing. You can't create a form in javacsript popup by what I know I have never seen anyone do this before, having a form popup you can just have your form come up in another window with _blank, and then have it send it that way, and tell the window to close when they click the submit button by using the javascript onunload function. Let me know how this works.
  17. maybe it has something to do with the way your php.ini file is configured but I don't know how to help with that.
  18. <BODY onLoad="javascript: alert('http://www.w3schools.com')"> this it the html tag here, it will go within your body tag. at the beginning. simply replace the url with your own, if that is what you are trying to do, if this is not what you wanted, well run the script if you get the desired affect then ok, if not then let me know exactly what you wanted to happen this will create a pop up window with the url on it, but I am not sure if that is what you meant, if not relay back to me exactly what you are wanting to happen, and next time I check my email i will come here and see what I can do.
  19. give me until tonight I am off right now and don't have a lot of time. I will work up something quick for you tonight, check again in like 5 hours.
  20. What happens in the following scenario. For instance if I want to create a parent class, and assign it a child, and a grandchild class. I decide that I want to create for instance a specific class, and I set it to final. If someone tries to change that variable in that class later it comes up with a fatal error, but couldn't the person just jump the the parent class anyway and change it from final to public with just a little typing, if this is true what is the purpose of setting it to final when it can still be changed.
  21. This might not help you much but if you are using php5 I know of a site that has the completely new system I read that the php object oriented programming entire system was redesigned here is a link, but I cna't help other than that, because I stopped studying tonight and haven't gotten into oop yet, I was starting that actually monday I just told my host to switch over my server to php5 it takes them 4 hours. [a href=\"http://www.hudzilla.org/phpbook/read.php/6_0_0\" target=\"_blank\"]http://www.hudzilla.org/phpbook/read.php/6_0_0[/a] see if you can find something there real quick, theres a section there on mysql databases too in case if that one I gave you doens't help.
  22. I honestly don't know if this is possible, I wanted to respond because no one had gotten around to answering you but as far as I know, no there isn't a way to do this, but I could be wrong.
×
×
  • 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.