dms Posted February 23, 2010 Report Share Posted February 23, 2010 (edited) Complete the form to send invitations. Type an email address for each invitation to send. Email <?php/* === this is where I'm lost. I can not capture the email values from the form, whether to later.... echo or send mail. === */if (isset($_GET['submit'])){ for ($n=1; $n<=10; $n++){ $email=$_GET['email']; echo "$email. $n". ''; } }?> Edited February 23, 2010 by dms Quote Link to comment Share on other sites More sharing options...
krillz Posted February 23, 2010 Report Share Posted February 23, 2010 you should check your php syntax, as you had dots and stuff flying right and left. anyway here you got your code working > Complete the form to send invitations. </pre> <form action="<?php%20echo%20%24_SERVER%20%5B'PHP_SELF'%5D;%20?>" method="POST" accept-charset="utf-8"> Type an email address for each invitation to send. Email for ( $i=1; $i $invite_tr = " "; echo $invite_tr; } ?> </form> <br><br><br>/* === this is where I'm lost. I can not capture the email values from the form, whether to later.... echo or send mail. === */<br>if (isset($_POST['submit'])){<br> for ($n=1; $n echo $n.' '.$_POST["email$n"].'<br>'; <br> }<br> }<br>?><br><br><br Quote Link to comment Share on other sites More sharing options...
dms Posted February 24, 2010 Author Report Share Posted February 24, 2010 Being new to coding in general, and starting to study again after several months off, this one stumped me for sure. Thank you krillz! I did not realize that you could add a variable to a string like you did. e.g., (name='email$i'). Now I need to add a bit more to this so that I can send emails and echo a list back. Thanks again, I'm sure I will need more assistance soon. Quote Link to comment Share on other sites More sharing options...
krillz Posted February 24, 2010 Report Share Posted February 24, 2010 (edited) Being new to coding in general, and starting to study again after several months off, this one stumped me for sure. Thank you krillz! I did not realize that you could add a variable to a string like you did. e.g., (name='email$i'). Now I need to add a bit more to this so that I can send emails and echo a list back. Thanks again, I'm sure I will need more assistance soon. Actually if you want the variable to be parsed you need to use double quotes as otherwise the variable will not be parsed: $beta = 'test'; echo 'This is a $beta'; // this will show: This is a $beta echo "This is a $beta"; // this will show: This is a test Also when you need to print out a lot of html it can be good to either close the php write your html then open it up again. Although it's a minus in terms of optimization it's not noticeable in small scripts. Another way could be using a variation of the echo statement: $uno = 'one'; $dos = 'two'; $tres = 'three'; echo A lot of text goes here put a lot of text here over several lines something that is a pain in the ass to have in quotes and stuff I can even put in my variables here and they will be parsed $uno $dos , $tres most likely misspelled but hey I do not speak spaninsh anyway I think you got the picture by now so I'll stop. END; Edited February 24, 2010 by krillz Quote Link to comment Share on other sites More sharing options...
dms Posted February 24, 2010 Author Report Share Posted February 24, 2010 Actually if you want the variable to be parsed you need to use double quotes as otherwise the variable will not be parsed: I understand double quotes needed to be parsed, but what confused me is that you don't need the double quotes in... name='email$i'. Now when capturing the value, I did need the double quotes. Somewhat confusing to me, but I'm slowly getting there. Another way could be using a variation of the echo statement: $uno = 'one'; $dos = 'two'; $tres = 'three'; echo <<A lot of text goes here put a lot of text here over several lines something that is a pain in the ass to have in quotes and stuff I can even put in my variables here and they will be parsed $uno $dos , $tres most likely misspelled but hey I do not speak spaninsh anyway I think you got the picture by now so I'll stop. END; I have read about this somewhere and I can see to where this could be used as you showed; I like it, but forget what it's called. Quote Link to comment Share on other sites More sharing options...
krillz Posted February 24, 2010 Report Share Posted February 24, 2010 if you look better you will spot that in fact we got double quote symbols: $invite_tr = " "; at the beginning and at the end you got " ". Quote Link to comment Share on other sites More sharing options...
dms Posted February 24, 2010 Author Report Share Posted February 24, 2010 Aha, I see. Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.