...

View Full Version : Need help with some coding



aussie1855
08-31-2009, 02:39 PM
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

ohgod
08-31-2009, 02:49 PM
re q1:


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

funnymoney
08-31-2009, 02:50 PM
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
$Firstname = 'Firstname';
$Surname = 'Surname';
$FullName = $firstname.' '.$surname;

?>

Scriptet
08-31-2009, 02:53 PM
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:


//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 :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum