PHP Form losing a space

  • dyfrin
  • Proficient
  • Proficient
  • User avatar
  • Joined: May 10, 2006
  • Posts: 344
  • Loc: WI
  • Status: Offline

Post September 29th, 2008, 2:18 pm

Hey guys,
Wracking my brain about this one.

My nice form (adapted it from somewhere) is deleting the spaces from the Name: field.

Here is the htm page:
Code: [ Download ] [ Select ]
 
<script type="text/javascript" src="/contact/mootools.js"></script>
<script type="text/javascript">
        window.addEvent('domready', function(){
            $('contact').addEvent('submit', function(e) {
            new Event(e).stop();
            var message = $('message_res').empty();
            this.send({
                update: message,
                onComplete: function() {
                document.contact.name.message();
                }
            });
            });    
        });
</script>
......
<form id="contact" name="contact" action="/contact/send.php" method="get">
 <div id="form_box">
  <div>
   <p>Your Name:</p>
   <input name="name" type="text" tabindex="1" value="" size="35" />
  </div>
.....
  <div id="submit">
   <button type="submit" onclick="this.blur()" name="button" tabindex="6" id="submitter"></button>
  </div>
</form>
  1.  
  2. <script type="text/javascript" src="/contact/mootools.js"></script>
  3. <script type="text/javascript">
  4.         window.addEvent('domready', function(){
  5.             $('contact').addEvent('submit', function(e) {
  6.             new Event(e).stop();
  7.             var message = $('message_res').empty();
  8.             this.send({
  9.                 update: message,
  10.                 onComplete: function() {
  11.                 document.contact.name.message();
  12.                 }
  13.             });
  14.             });    
  15.         });
  16. </script>
  17. ......
  18. <form id="contact" name="contact" action="/contact/send.php" method="get">
  19.  <div id="form_box">
  20.   <div>
  21.    <p>Your Name:</p>
  22.    <input name="name" type="text" tabindex="1" value="" size="35" />
  23.   </div>
  24. .....
  25.   <div id="submit">
  26.    <button type="submit" onclick="this.blur()" name="button" tabindex="6" id="submitter"></button>
  27.   </div>
  28. </form>


Here is the php page:
Code: [ Download ] [ Select ]
elseif($_POST['sendtype'] == 'phone'){
            $to = 'numberhere!@txt.att.net';
            $headers =  'From: '.$_POST['name']. "\r\n" .
                    'X-Mailer: PHP/' . phpversion();
            $subject = "";
            $message = htmlspecialchars($_POST['message']) . $_POST['contact'];
            }
  1. elseif($_POST['sendtype'] == 'phone'){
  2.             $to = 'numberhere!@txt.att.net';
  3.             $headers =  'From: '.$_POST['name']. "\r\n" .
  4.                     'X-Mailer: PHP/' . phpversion();
  5.             $subject = "";
  6.             $message = htmlspecialchars($_POST['message']) . $_POST['contact'];
  7.             }


Any idea why the space would get stripped?
There is no check except for the mootools, which shouldn't be doing any validation.
dyfrin.com
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post September 29th, 2008, 2:18 pm

  • dyfrin
  • Proficient
  • Proficient
  • User avatar
  • Joined: May 10, 2006
  • Posts: 344
  • Loc: WI
  • Status: Offline

Post September 29th, 2008, 4:02 pm

Ok after some testing it is only when sent to the iPhone and only the FROM.
The message body is not affected.

Strange thing is that the normal SMS have spaces in the from. Might be their sms-smtp gateway that is stripping spaces in the name.

Anyone with a different cell phone test this out to see if its common amoung all sms gateways or just some mishap?
dyfrin.com
  • dyfrin
  • Proficient
  • Proficient
  • User avatar
  • Joined: May 10, 2006
  • Posts: 344
  • Loc: WI
  • Status: Offline

Post October 2nd, 2008, 7:21 am

Ok now this is wierd, sending from outlook through smtp of exchange to att phone and name has spaces. Calling 611 to figure this out, but doubt they will be of help.
dyfrin.com

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 139 guests
  • 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 post attachments in this forum
 
 

© Unmelted Enterprises 1998-2009. Driven by phpBB © 2001-2009 phpBB Group.