Question: I have an e-mail variable . How do I check that the e-mail entered here is in the name @ sitename.com format?
Code:
if (!eregi ("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$", $email)) die ("Your e-mail address is invalid");
Question: I write code but sometimes it gives errors but I don't want it to print these errors on the screen?
Code:
@mysql_connect ( 'localhost', 'username', 'password');
Question: I made my site in both English and German. How can I automatically open the site in this language according to the visitor's language?
Code:
$lisan = $_SERVER["HTTP_ACCEPT_LANGUAGE"]; if ( $lisan == "tr") { header("Location:index_tr.php"); } else { header("Location:index_en.php"); }
Question: When sending mail with PHP, what is the main function used and how is it used?
Code:
mail (" name @ g will be sentaddress.com", $ subject, stripslashes ($ message), $ mailtanim);
Question: Although I send the variable as index.php? Value = 4, I cannot read this value in index php.
There are different reading methods for each method. If you sent the data as index.php? Value = 4, you can get the data as follows.
Code:
$ variable = $ _GET ['value'];
If you sent the data with the POST method (POST method is usually used with the button), you can get the data as follows.
Code:
$ variable = $ _POST ['value'];
Question: Some sites I www.sitename.co / index.php? P = page not in the form I www.sitename.co /? P = page I saw was used as variables How can I do this?
There is nothing you need to do for this. In the form of? p = page, the page name is not specified because the variable will be sent to the index.php file. This is because the default page name on the server is index.php. If you will send values to pages such as page.php or contact.php other than index.php, you must specify this (Ex: www.sitename.com / contact.php? P = value ). Because if you don't, the variable will be sent to the default page, index.php. __________________