Jump to content


Photo

Combining Data


  • Please log in to reply
3 replies to this topic

#1 cab

cab
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 11 September 2006 - 02:52 PM

Don't ask why i'm doing my email address this way :) (problems storing it normally) but anyways....

echo "<tr>
          <td align='right'> <B>Email</br></td>
          <td><input type='text' name='email1' size='30' maxlength='65' >
            &nbsp;@ &nbsp;<input type='text' name='email2' size='26' maxlength='65' ></td>
          </tr>";

  $expemail = $_POST['expemail1']."@";
  $expemail .= $_POST['expemail2'];

Will this code above combine "email1" and "email2" into the variable "email" which can then be stored in the database?

Please advise......

#2 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 11 September 2006 - 02:58 PM

$expemail = $_POST['email1']."@";
$expemail .= $_POST['email2'];

will

just use addslashes if you are having probs storing in the db.
follow me on twitter @PHPsycho

#3 cab

cab
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 11 September 2006 - 02:59 PM

I'm sorry i'm really new at PHP and i'm kind of self-teaching from a book i bought.

What exactly are "addslashes"

#4 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 11 September 2006 - 03:00 PM

Just to add to the above this should also work..

$expemail = $_POST['expemail1']."@".$_POST['expemail2'];


but this would be a safer option also

$expemail = mysql_real_escape_string($_POST['expemail1']."@".$_POST['expemail2']);

This will escape alot a bas stuff before you insert into your DB

Regards
Liam
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users