Tutorialstream.com Forum Index
 FAQ   Search   Members   Usergroups   Register   Profile   Log in to check your private messages   Log in 

Log in
Username:    Password:      Log me on automatically each visit    
limiting the characters in the textarea area
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Tutorialstream.com Forum Index -> Web Design
View previous topic :: View next topic  
Author Message
Fed
Site Admin


Joined: 12 Aug 2005
Posts: 176

PostPosted: Mon Jan 09, 2006 11:59 am    Post subject: Reply with quote

try this way ( I am not sure of the php syntax as I wrote it right now Neutral)
Code:

<?PHP
$to = "you@xyz.com";
$subject = "Order";
$headers = "Order";
$forward = 0;
$location = "";
$date = date ("l, F jS, Y");
$time = date ("h:i A");
$msg = "Message Date: $date Time: $time.\n\n";
if ($_SERVER['REQUEST_METHOD'] == "POST")
{
   foreach ($_POST as $key => $value)
   {
      if (empty($value))
      {
         if ($value!=0)
         {
             echo "Please go back and fill all the required fields.";
             Die();
         }
      $msg .= ucfirst ($key) ." : ". $value . "\n";
      }
   }
}
else
{
   foreach ($_GET as $key => $value)
   {
      if (empty($value))
      {
         if ($value!=0)
         {
             echo "Please go back and fill all the required fields.";
             Die();
         }
      $msg .= ucfirst ($key) ." : ". $value . "\n";
      }
   }
}
mail($to, $subject, $msg, $headers);
if ($forward == 1) {
header ("Location:$location");
}
else {
echo "Thank you for your order!";
}

?>

I am absolutely not sure it works....also if the syntax was correct Very Happy[/code]
Back to top
View user's profile Send private message Send e-mail Visit poster's website
pappszaby



Joined: 21 Nov 2005
Posts: 30

PostPosted: Mon Jan 09, 2006 12:10 pm    Post subject: Reply with quote

This way is working only if the entered value is 0
If you write anything else than 0 it goes trough I mean the mail has been procesed but the mail is empty only were you have entered 0 is being sent to the email address provided.
Back to top
View user's profile Send private message
Fed
Site Admin


Joined: 12 Aug 2005
Posts: 176

PostPosted: Mon Jan 09, 2006 12:59 pm    Post subject: Reply with quote

LOL you're right Very Happy
you might try with the previous php code and altering this:
Code:

<script type="text/javascript">
function boxChecked(form)
{
   if(!document.myform.C1.checked)
   {
      alert("Please check the checkbox and smile ;)");
      return false;
   }
   counter.value = OK;
   return true;
}
</script>


this is a bit lamer solution but it's the first thing that came into my mind Smile
Back to top
View user's profile Send private message Send e-mail Visit poster's website
pappszaby



Joined: 21 Nov 2005
Posts: 30

PostPosted: Mon Jan 09, 2006 1:19 pm    Post subject: Reply with quote

still not succes!
Can we stop the counter at "1"?
Confused
Back to top
View user's profile Send private message
Fed
Site Admin


Joined: 12 Aug 2005
Posts: 176

PostPosted: Mon Jan 09, 2006 1:27 pm    Post subject: Reply with quote

uhm, why not
try if this work
Code:

<script language="Javascript" type="text/javascript">
function countAreaChars(areaName,counter,limit)
{
   if (areaName.value.length>limit)
   areaName.value=areaName.value.substring(0,limit);
   else
   if($counter!=1)
   {
      counter.value = limit - areaName.value.length;
   }
}
</script>
Back to top
View user's profile Send private message Send e-mail Visit poster's website
pappszaby



Joined: 21 Nov 2005
Posts: 30

PostPosted: Mon Jan 09, 2006 1:37 pm    Post subject: Reply with quote

I'we got an error! Crying or Very sad
Is not working
Back to top
View user's profile Send private message
Fed
Site Admin


Joined: 12 Aug 2005
Posts: 176

PostPosted: Mon Jan 09, 2006 1:39 pm    Post subject: Reply with quote

lol....I used a php variable into the javascript code Neutral
Code:

<script language="Javascript" type="text/javascript">
function countAreaChars(areaName,counter,limit)
{
   if (areaName.value.length>limit)
   areaName.value=areaName.value.substring(0,limit);
   else
   if(counter.value!=1)
   {
      counter.value = limit - areaName.value.length;
   }
}
</script>
Back to top
View user's profile Send private message Send e-mail Visit poster's website
pappszaby



Joined: 21 Nov 2005
Posts: 30

PostPosted: Mon Jan 09, 2006 1:48 pm    Post subject: Reply with quote

NOw I donT get an error but still goes under 1 so I get a 0
Back to top
View user's profile Send private message
pappszaby



Joined: 21 Nov 2005
Posts: 30

PostPosted: Mon Jan 09, 2006 1:58 pm    Post subject: Reply with quote

Laughing Laughing Laughing Laughing Laughing Laughing Laughing Laughing Laughing Laughing Laughing Laughing Laughing
Sorry for the false alarm is working it stops at 1
Laughing Laughing Laughing Laughing Laughing Laughing Laughing Laughing Laughing Laughing Laughing Laughing Laughing
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Tutorialstream.com Forum Index -> Web Design All times are GMT + 1 Hour
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

phpBB SEO URLs V2 - Icons by Mark James

Powered by phpBB © 2001, 2005 phpBB Group