Jump to content

form to send email invitations


dms

Recommended Posts


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 by dms
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by krillz
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...