Jump to content

Archived

This topic is now archived and is closed to further replies.

cab

Combining Data

Recommended Posts

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......

Share this post


Link to post
Share on other sites
$expemail = $_POST['email1']."@";
$expemail .= $_POST['email2'];

will

just use addslashes if you are having probs storing in the db.

Share this post


Link to post
Share on other sites
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"

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.