Hi Everyone,
I want your help.Is it possible that visitors of my site enter their name and cell phone number in a small form on the portal and submitt that to me (administrator) so I can keep them informed about site updates by sms ?
I want only two fields in form
Name:
Cell number:
After submitting gives a message like > thank you, we will keep you updated via sms for any website updates.
I hope brilliant people here can help me. :)
regards,
Jim.
who is going to pay for that :o
This will send send form contents to your email address. There is no error checking in this code and you probably would only want registered users to see it to prevent spammers from sending stuff.
I have the form labels set up for Name and Phone number, but they can be changed for other uses. Don't use textareas unless you know the particular problems that TinyPortal has with textareas.
global $scripturl;
$youremail = 'you@yourdomain.com'; // Enter your email address here
$emailtitle = 'Whatever you want your email title to be';
$str = getenv("QUERY_STRING");
if ($str)
$action = 'index.php?'.$str;
else
$action = 'index.php';
if (isset($_POST['submit']))
{
$message='';
isset($_POST['name']) ? $name = $_POST['name'] : $name = '';
isset($_POST['phone']) ? $phone = $_POST['phone'] : $phone = '';
$text = "Name = $name \n Phone = $phone";
mail( $youremail, $emailtitle, $text);
echo 'Thank you';
}
else
{
// You'll want to make the form prettier
echo '<form method="post" action="' . $action . '">';
echo '<table>';
echo '<tr><td>Name:</td></tr><tr><td><input type="text" name="name" /></td></tr>';
echo '<tr><td>Cell phone:</td></tr><tr><td><input type="text" name="phone" /></td></tr>';
// add whatever other fields you want for your form
echo '<tr><td align="center"><input type="submit" name="submit" value="Send"></td></tr>';
echo '</table>';
echo '</form>';
}
oostcoast I have unlimited sms package from my service provider ;)
JPDeni Thanks a lot for your help. I made a scriptbox and edited email address in the code and paste in scriptbox but I see the following lines appearing on the Name and Phone number text fields.
global $scripturl; $youremail = 'info@casestudents.net'; // Enter your email address here $emailtitle = 'SMS Alerts from CASE Students Forum'; $str = getenv("QUERY_STRING"); if ($str) $action = 'index.php?'.$str; else $action = 'index.php'; if (isset($_POST['submit'])) { $message=''; isset($_POST['name']) ? $name = $_POST['name'] : $name = ''; isset($_POST['phone']) ? $phone = $_POST['phone'] : $phone = ''; $text = "Name = $name \n Phone = $phone"; mail( $youremail, $emailtitle, $text); echo 'Thank you CASE Students Forum Member'; } else { // You'll want to make the form prettier echo ' '; echo ''; echo ' Name:
'; echo ' Cell phone:
'; // add whatever other fields you want for your form echo '
'; echo '
And I see the following lines appear after send button
'; echo '
'; }
I really appreciate your help.
Regards,
Jim
It goes in a php box. Sorry. I guess I thought it would be evident.
is there anyway you can change fields to that?
for instance a joining form for a "fantasy wrestling" league.
Name:
Height:
Weight:
Hometown:
Theme Music:
Pic: **See question below***
Heel/Face:
Email:
Bio:
Also, is there a way to add an uploadable button to attach a pic to the email?
Quote from: oostcoast on January 25, 2007, 02:59:02 PM
who is going to pay for that :o
Quote from: funxlab on January 25, 2007, 03:54:57 PM
oostcoast I have unlimited sms package from my service provider ;)
There are a number of ways to SEND such SMS messages without cost.
But I don't know a lot of regular forum users (or moderators/co-Admins, for that matter) who wouldn't rather find out about 'site news' from email than to pay to receive every 150 (or so) character 'chunk' of information.
We've got two discussions going on here which are completely different issues. One is
-- How do I create a form that users can fill out to send information to the site administrator?
-- Is it wise for a site administrator to send out information via cell phone?
This topic is in the Block code snippets child board, which is about coding. My suggestion would be that, if folks want to discuss the wisdom of a site administrator sending out information via cell phone, they start a topic in the chit chat board.
Or, I suppose I can just start a topic about how to have a form in a block, separate from what the subject matter is.
Tolerance, yes, you can have as many fields as you want, with any names that you want. I don't know how to upload a picture to attach to an email. Sorry.
JPDeni
Thanks a lot for your help, as a newbie to TP I have a little idea :p
J.A.Cortina
My forum members will never been more than 700 as its a college community and my students prefer sms on email.
Regards,
Jim.
I have this code setup to display the several different fields, but when it's emailed it only sends the Name and Phone. How do I add the other fields to be sent with the email? Please and thank you. ;)
Use the code at
http://www.tinyportal.net/index.php?topic=12712.0
which is a general code that is easier to edit.