Jump to content


Photo

Adding an "@domain.com" symbol automatically.


  • Please log in to reply
4 replies to this topic

#1 dan182skater

dan182skater
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 25 October 2006 - 11:02 PM

Hello everyone, how do I add into my SQL database an "@" symbol after someone types in the first part of their email address? What I mean is I have a blank text box followed by "@berkeley.edu and I want people to only type in the first part of their Berkeley email address. Basically, only people that have a Berkeley email addresses can sign up on my site. So there are two basic functions I need:

1. Verify that the guest who is signing up ONLY typed in letters, numbers, etc (ONLY things that would be in the first part of an email, before the "@")
2. Automatically insert into the form/database/whatever the @berkeley.edu for every email.

Any help is greatly appreciated. THANKS!

#2 marcus

marcus
  • Members
  • PipPipPip
  • Advanced Member
  • 1,842 posts
  • LocationRochester, NY

Posted 26 October 2006 - 12:03 AM

just do

$sql = "INSERT INTO dbtable (`email`) VALUES ('$email@berkeley.edu');";
$result = mysql_query($sql);


#3 jwk811

jwk811
  • Members
  • PipPipPip
  • Advanced Member
  • 714 posts

Posted 26 October 2006 - 12:06 AM

you can change it into a variable in the script by doing this:
<?
$first_part = $_POST['first_part'];
$domain = "@berkeley.edu";
$email = $first_part . $domain;
?>
<?
echo "$email";
?>
the email variable would then be the first part of what they entered and the domain would be at the end coming out into the full email like that..

#4 dan182skater

dan182skater
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 26 October 2006 - 12:49 AM

Thanks for your replies!!!! But where do I type in the code? I uploaded join.php to my site here:

http://www.blissfulh...anners/join.zip

If anyone could download that file (which is a zip with one file, join.php) and tell me where (line number, etc) to put in the code, I will repay you someway, somehow. THANKS!

Also, it is a zip file just to make sure it doesn't load in the browser and so that you can download it to youre computer to open it with your php editor of choice.

THANKS!

-Daniel

#5 jwk811

jwk811
  • Members
  • PipPipPip
  • Advanced Member
  • 714 posts

Posted 26 October 2006 - 02:02 AM

once someone goes to log in.. the form action should lead to a script that sends the email or whatever you're trying to do with it..




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users