corecodeschool.blogspot.com in any corecode like php, html, css, java, JavaScript, Ajax also database related query and some sort and simple code and small code and some shortcut here and start with first step in any language
Thursday, 12 October 2017
Thursday, 31 August 2017
core code cookies update
update
1.COOKIES
=> SETTING A COOKIE
Syntax :
Set-cookie:NAME=value;EXPIRES=date;PATH=path;DOMAIN=domain;SECURE
document.write('<tr>');
document.write('<td width="25%">First Name</td>');
document.write('</tr>');
2.VALIDATION
2.1 Field Name cannot be left empty
------------------------------
/* Cheking if the variable for Client's name is empty,(i.e.a blank Client's name field was submitted .) */
if(empty($_POST['txtName']))
{
/*returning data entry form if the Client's name is empty.*/
$alertmessage="<center>
Filed for Client\'s Name is empty!
</center>";
inclide("page2.php");
exit;
}
2.2 No double spacing in the field name captured
-----------------------------------------
=> To test double spacing validation,insert double spaces in between the Client Name and click submit button .
=> The PHP code checks the contents of Client Name field returned by the Browser. As it has double spacing,an error message is generated and stored in the variable $alertmessage.
ereg("([[:space:]]{2})",$_POST["txtName"]);
------------------------------------------------------------------------------
else
{
if(ereg("([[:space:]]{2})",$_POST["txtName"]))
{
/*
returning data entry form if the Client's name contains double spaces.
*/
$alertmessage="<center>
Double spaces found in Client\'s Name!
</center>";
inclide("page2.php");
exit;
}
}
--------------------------------------------------------------------------------------------------------
2.1 Field Name cannot be left empty
if(empty($_POST['txtName']))
{
/*returning data entry form if the Client's name is empty.*/
$alertmessage="<center>
Filed for Client\'s Name is empty!
</center>";
inclide("page2.php");
exit;
}
2.2 No double spacing in the field name captured
-----------------------------------------
=> To test double spacing validation,insert double spaces in between the Client Name and click submit button .
=> The PHP code checks the contents of Client Name field returned by the Browser. As it has double spacing,an error message is generated and stored in the variable $alertmessage.
ereg("([[:space:]]{2})",$_POST["txtName"]);
------------------------------------------------------------------------------
else
{
if(ereg("([[:space:]]{2})",$_POST["txtName"]))
--------------------------------------------------------------------------------------------------------
basic core code
Basic Code
1. How to create one form
<html>
<head>
// you have put hear any meta tag or css depended on you.
</head>
<body>
<form action="process.html" method="post">
Name : <input type="text" name="nm"/><br/>
Add : <input type="text" name="add"/><br/>
Mo No : <input type="text" name="no"/><br/>
Other : <input type="text" name="otr"/><br/>
</form>
</body>
</html>
2. How to use switch case
switch (num)
3. How to create array using script
var demo = new array();
Tuesday, 11 October 2016
what is ajax?how to create ajax with php code
Ajax Introduction
- એજેક્સ નો ઉપીયોગ કરી ને તમે પેજ લોડ કાર્ય વિના બધી માહિતી મેળવી શકો.એજેક્સ થી તમે કોઈ પણ ડેટા ઝડપ થી મેળવી શકો છો
- अजाक्स का उपियोग करके आप कोई भी डाटा स्पीड में ले सकते हे और इसकी प्रोसेस प्रोसेसबार में नहीं दिखती अजाक्स अपने डाटा सर्वर को सेंड करते समय सेकुएंस मेन्टेन नहीं करता इस लिए हम डाटा फ़ास्ट एक्सेस कर सकते हे
- Ajax stands for Asynchronous JavaScript and XML. Ajax isn’t a technology;
it mixes well-known programming techniques in an uncommon way to enable web
developers to build Internet applications with much more appealing user
interfaces.
- अजाक्स का उपियोग करके आप कोई भी डाटा स्पीड में ले सकते हे और इसकी प्रोसेस प्रोसेसबार में नहीं दिखती अजाक्स अपने डाटा सर्वर को सेंड करते समय सेकुएंस मेन्टेन नहीं करता इस लिए हम डाटा फ़ास्ट एक्सेस कर सकते हे
- The
parts of an Ajax application that happen "under the hood" of the
browser, such as sending server queries and dealing with the returned data, are
written in JavaScript, and XML is a means of coding and transferring formatted
information used by Ajax to efficiently transfer data between server and
client.
-Microsoft
first introduced the XMLHTTPRequest object, implementing it in Internet
Explorer 5 as an ActiveX object.
- The following line creates an XMLHTTPRequest object called request
var request = new XMLHTTPRequest();
- Here we have declared a variable request and assigned to it the value returned from the statement
new XMLHTTPRequest(),which is invoking the constructor method for the XMLHTTPRequest object.
- To achieve the equivalent result in Microsoft Internet Explorer, you need to create an ActiveX object.
Here's an example
var request = new ActiveXObject("Microsoft.XMLHTTP");
- This assigns the name request to the new object.
- Some versions of Internet Explorer have a different version of MSXML, the Microsoft XML parser,
installed in those cases you need to use the following instruction
var request = new ActiveXObject("Msxml2.XMLHTTP");
- For cross Browser detection, this is the following code :
function ajaxFunction()
{
var xmlhttp;
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
else
{
alert("Your browser does not support XMLHTTP!");
}
}
In above example create a variable named xmlhttp to hold the XMLHttpRequest object,
Try to create the XMLHttpRequest object with xmlhttp=new XMLHttpRequest(). If that fails,
try xmlhttp=new ActiveXObject("Microsoft.XMLHTTP").
This is for IE6 and IE5. If that fails too, the user has a very outdated browser,
and will get an alert stating that the browser doesn't support XMLHTTP.
document.getElementById('changed').innerHTML = http.responseText;
}
}
Sunday, 2 October 2016
how to use css in your website CSS stands for Cascading Style Sheets.
1. What is CSS?
CSS stands for Cascading Style Sheets.
CSS is a stylesheet language used to design and style web pages. It controls how HTML elements appear in a browser.
Using CSS, you can change:
Text color and font size.
Background colors and images.
Width and height of elements.
Margins and padding.
Borders and shadows.
Page layouts and alignment.
Animations and transitions.
Responsive designs for mobile phones, tablets, and computers.
Example: HTML creates a button, while CSS makes the button colorful, attractive, and interactive.
2. Why Do We Use CSS?
Consider a simple HTML heading:
<h1>Welcome to My Website</h1>Without CSS, the heading uses the browser's default styling.
With CSS, you can change its color, size, and alignment.
<!DOCTYPE html><html><head><title>My First CSS Page</title><style>h1 {color: blue;text-align: center;font-size: 36px;}</style></head><body><h1>Welcome to My Website</h1></body></html>
Output: The heading appears in blue, centered on the page, with a font size of 36 pixels.
3. Basic CSS Syntax
CSS consists of three main parts:
selector {property: value;}
For example:
p {color: red;font-size: 20px;}
Let's understand each part.
Component |
Meaning |
Example |
|---|---|---|
Selector |
Identifies the HTML element to style |
|
Property |
Specifies what you want to change |
|
Value |
Specifies the desired setting |
|
Declaration |
A property and its value |
|
Declaration block |
All declarations inside |
|
Here, all paragraph (<p>)
elements will have red text with a font size of 20 pixels.
Important CSS rules
Use
{ }to enclose declarations.Use
:between a property and its value.Use
;to separate declarations.CSS comments are written as
/* comment */.
how create template using html5 tags
- यह पोस्ट में आप HTML5 के टैग का उपयोग करके बहुत सरलता से अपनी डिजाईन और फॉर्म बना सकते हे.
- In this post you very simply by using HTML5 tags, create your own design and form.
- આ પોસ્ટ માં તમે HTML5 નો ઉપયોગ કરી ખુબજ સરળતા થી તમારી પોતાની Design અને ફોર્મ(Form) બનાવી શકો છો.
Monday, 2 May 2016
How to create Regular expression validation in php
<?php session_start(); ?>
<html>
<head>
<title>Registration</title>
</head>
<body>
<?php
if(isset($_SESSION['vali']['ok']))
{
echo '<span style="color:green;">'.$_SESSION['vali']['ok'].'</span>';
}
?>
<form action="process.php" method="post" enctype="multipart/form-data">
FullName : <br/>
<input type="text" name="fnm">
<?php
if(isset($_SESSION['vali']['fnm']))
{
echo '<span style="color:red;">'.$_SESSION['vali']['fnm'].'</span>';
}
?>
<br/><br/>
UserName : <br/>
<input type="text" name="unm">
<?php
if(isset($_SESSION['vali']['unm']))
{
echo '<span style="color:red;">'.$_SESSION['vali']['unm'].'</span>';
}
?>
<br/><br/>
Password : <br/>
<input type="password" name="pwd">
<?php
if(isset($_SESSION['vali']['pwd']))
{
echo '<span style="color:red;">'.$_SESSION['vali']['pwd'].'</span>';
}
?>
<br/><br/>
Conform Password : <br/>
<input type="password" name="cpwd">
<?php
if(isset($_SESSION['vali']['cpwd']))
{
echo '<span style="color:red;">'.$_SESSION['vali']['cpwd'].'</span>';
}
if(isset($_SESSION['vali']['pwdm']))
{
echo '<span style="color:red;">'.$_SESSION['vali']['pwdm'].'</span>';
}
?>
<br/><br/>
Mobile No : <br/>
<input type="text" name="mno">
<?php
if(isset($_SESSION['vali']['mno']))
{
echo '<span style="color:red;">'.$_SESSION['vali']['mno'].'</span>';
}
if(isset($_SESSION['vali']['digits']))
{
echo '<span style="color:red;">'.$_SESSION['vali']['digits'].'</span>';
}
if(isset($_SESSION['vali']['max']))
{
echo '<span style="color:red;">'.$_SESSION['vali']['max'].'</span>';
}
?>
<br/><br/>
Email Id : <br/>
<input type="text" name="email">
<?php
if(isset($_SESSION['vali']['email']))
{
echo '<span style="color:red;">'.$_SESSION['vali']['email'].'</span>';
}
if(isset($_SESSION['vali']['regex']))
{
echo '<span style="color:red;">'.$_SESSION['vali']['regex'].'</span>';
}
unset($_SESSION['vali']);
?>
<br/><br/>
<input type="submit" value="Submit">
</form>
</body>
</html>
process.php
<?php session_start();
$_SESSION['vali']=array();
extract($_POST);
if(empty($_POST['fnm']))
{
$_SESSION['vali']['fnm']="Enter Fullname";
}
if(empty($_POST['unm']))
{
$_SESSION['vali']['unm']="Enter Username";
}
if(empty($_POST['pwd']))
{
$_SESSION['vali']['pwd']="Enter Password";
}
if(empty($_POST['cpwd']))
{
$_SESSION['vali']['cpwd']="Enter Re-Password";
}
if($_POST['pwd'] != $_POST['cpwd'])
{
$_SESSION['vali']['pwdm']="Do not match password";
}
if(empty($mno))
{
$_SESSION['vali']['mno']="Enter Mobile No";
}
else if(!is_numeric($mno))
{
$_SESSION['vali']['digits']="Enter Digits";
}
else if(strlen($_POST['mno'])<10)
{
$_SESSION['vali']['max']="Enter 10 Digits";
}
if(empty($_POST['email']))
{
$_SESSION['vali']['email']="Enter Email Id";
}
if(! ereg("^[a-z0-9_]+[a-z0-9_.]*@[a-z0-9_-]+[a-z0-9.-]*\.[a-z]{2,5}$",$_POST['email']))
{
$_SESSION['vali']['regex']="Email not valid";
}
if(!empty($_SESSION['vali']))
{
header('location:index.php');
}
else
{
extract($_POST);
$link=mysql_connect('localhost','root','')or die("connect problem");
mysql_select_db('test',$link);
$q="insert into register(fnm,unm,pwd,mno,email)values('$fnm','$unm','$pwd','$mno','$email')";
mysql_query($q);
$_SESSION['vali']['ok']="Record Insrted";
header('location:index.php');
}
?>
Featured post
Contact
Contact Core Code School Core Code School shares beginner-friendly tutorials on PHP, HTML, CSS, JavaScript, Java, SQL and Ubuntu. You can...
-
How to Learn Ubuntu Commands Like a Pro 💻 Learning Ubuntu commands is one of the best ways to understand how Linux really works. Whether...
-
Let’s walk through how to create a simple Spring Boot program — step by step. We’ll build a small “Hello World” REST API using Spring Bo...
-
1. What is CSS? CSS stands for Cascading Style Sheets. CSS is a stylesheet language used to design and style web pages. It control...
-
- यह पोस्ट में आप HTML5 के टैग का उपयोग करके बहुत सरलता से अपनी डिजाईन और फॉर्म बना सकते हे. - In this post you very simply by using HTML...
