Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Aug 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Need help with some coding

    I have 2 coding questions:

    Q1: i have two input variables that are a form that holds 'First Name' and 'Surname' i need some code to then output the variables to a third called 'Full Name'

    Q2: my submit_email.php has an entry for a user to input their email address which is then used within the form as a variable called 'email'. However my domain host only allow email from within the domain so i need to hard code the address. How can I do this.

    Any suggestion, comments advice would be most gratefull

    Thank you


    Michael

  • #2
    Regular Coder ohgod's Avatar
    Join Date
    Jun 2008
    Location
    Ohio
    Posts
    579
    Thanks
    6
    Thanked 69 Times in 69 Posts
    re q1:

    PHP Code:
    $var1 "Hello";
    $var2 "world!";
    $var3 $var1.' '.$var2;
    echo 
    $var3;
    //yields: Hello world! 

  • #3
    Regular Coder funnymoney's Avatar
    Join Date
    Aug 2007
    Posts
    364
    Thanks
    17
    Thanked 24 Times in 24 Posts
    Quote Originally Posted by aussie1855 View Post
    I have 2 coding questions:

    Q1: i have two input variables that are a form that holds 'First Name' and 'Surname' i need some code to then output the variables to a third called 'Full Name'

    PHP Code:
    <?php
    $Firstname 
    'Firstname';
    $Surname 'Surname';
    $FullName $firstname.' '.$surname;

    ?>

  • #4
    Regular Coder
    Join Date
    Apr 2008
    Posts
    685
    Thanks
    15
    Thanked 105 Times in 104 Posts
    Quote Originally Posted by aussie1855 View Post
    I have 2 coding questions:

    Q1: i have two input variables that are a form that holds 'First Name' and 'Surname' i need some code to then output the variables to a third called 'Full Name'
    You can use the concatenate character (.) to join strings together like:
    PHP Code:
    //variables
    $firstname "john";
    $lastname "james";
    $fullname $firstname."".$lastname

    //output
    echo "First Name:".$firstname."<br />";
    echo 
    "Last Name:".$firstname."<br />";
    echo 
    "Full  Name:".$fullname."<br />";
    echo 
    "Full Name Method 2:".$firstname." ".$lastname."<br />"
    Then we just use the echo statement to output them to the screen.

    Q2: my submit_email.php has an entry for a user to input their email address which is then used within the form as a variable called 'email'. However my domain host only allow email from within the domain so i need to hard code the address. How can I do this.
    What do you mean, you need to check if the submitted e-mail address has the same domain as yours?

    If so you'd need to do a pregmatch of some sort and check that after the @ sign it matches your domain, but i dont know how to do this


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •