Home  >  Article  >  Backend Development  >  Program for transferring values ​​to each other in PHP+js+html+mysql_PHP tutorial

Program for transferring values ​​to each other in PHP+js+html+mysql_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:14:17878browse

This article introduces how PHP & HTML & JavaScript & MySQL codes transfer values ​​to each other. Friends who need to learn can refer to

1.PHP

a.PHP -> HTML & JavaScript

Um, it’s super simple, I want to write it too = =~

In html code

 代码如下 复制代码
/>

In JavaScript code

 代码如下 复制代码
 

b.PHP <-> MySQL


in php code
The code is as follows Copy code
 代码如下 复制代码


$dbcnx = @mysql_connect ( "localhost", "root", "1234" );
if (! $dbcnx) {
echo ("Unable to connect to the " . "database server at this time.");
exit ();
}

if (! @mysql_select_db ( "pms" )) {
echo ("Unable to locate the joke " . "database at this time.");
exit ();
}
mysql_query ( "SET NAMES 'GB2312'" );


$q=mysql_query("select * from ability where ALV = 1");
while($row=mysql_fetch_array($q)){
$array1[] = $row[AName];
}
?>

$dbcnx = @mysql_connect ( "localhost", "root", "1234" );

if (! $dbcnx) {

echo ("Unable to connect to the " . "database server at this time.");

exit ();

}
代码如下 复制代码



 

if (! @mysql_select_db ( "pms" )) {

echo ("Unable to locate the joke " . "database at this time.");
 代码如下 复制代码
echo $_POST['count'];
?> 
exit (); } mysql_query ( "SET NAMES 'GB2312'" ); $q=mysql_query("select * from ability where ALV = 1"); While($row=mysql_fetch_array($q)){ $array1[] = $row[AName]; } ?> 2.HTML a. HTML -> PHP (POST method) html code
The code is as follows Copy code
 do.php file code
The code is as follows Copy code
echo $_POST['count'];<🎜> ?>

b. HTML -> JavaScript


In JavaScript code (available, changeable)

The code is as follows
 代码如下 复制代码

Copy code

 代码如下 复制代码
 

3.JavaScript
 代码如下 复制代码
  b. JavaScript ->

a. JavaScript -> HTML (generic, unverified)

In JavaScript code

The code is as follows
 代码如下 复制代码

  2.html代码给php




  3.do.php接收到

echo $_POST['count'];
?>

Copy code
  HTML code PHP Transfer via html 1. The JavaScript code is given to html first
The code is as follows Copy code
2.html code to php
 3.do.php received echo $_POST['count'];<🎜> ?> http://www.bkjia.com/PHPjc/629049.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/629049.htmlTechArticleThis article introduces about PHP JavaScript gt; HTML JavaScript is super simple, I also have to write = =~ html code Copy the code as follows input type= readonly=readonly style='background...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn