Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Php check button without javascript

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Php check button without javascript

Postby sousatoufi » Thu Jan 30, 2014 6:14 am

please help me,
i've an user who retrieve a book info from mssql server database, he can reserve the book by click on the button, my question is when the user click the button, how can i call mssql server procedure that will check if the book is available or not, below is my php code that retrieve the book info from the database.

<?php

//connexion à la base
// require 'connecterBD_SQLSRV.php';
require './connecterBD_SQLSRV.php';
$resultat = connecterBD_SQLSRV();
$sMsg='';
if (is_object($resultat)) {
$oPdo = $resultat;
} else {
$sMsg = $resultat;
}

/* remplacement de la chaine de caractère ' (simple-quote) par une double '' (simple-quote)
pour obtenir une requete sql compatible avec mssql */
$_GET['Liv_Titre'] = str_replace("'", "''", $_GET['Liv_Titre']);
$_GET['Aut_Nom'] = str_replace("'", "''", $_GET['Aut_Nom']);
$_GET['Thm_Libel'] = str_replace("'", "''", $_GET['Thm_Libel']);

//vérifier que les Recherche champs de sont vides
if (($_GET['Liv_Isbn'] == '') && ($_GET['Liv_Titre'] == '') &&
($_GET['Aut_Nom'] == '') && ($_GET['Aut_Prenom'] == '') &&
($_GET['Thm_Libel'] == '')) {
echo "s'il vous plaît remplir une domaine de recherche ";

}
else{
if ($_GET['Liv_Isbn'] != '') {
$requete = 'SELECT * FROM stgxx.vw_Titre_Thm_Aut WHERE Liv_Isbn = \'' . $_GET['Liv_Isbn'] . '\'';
}
elseif ($_GET['Liv_Titre'] != '') {
$requete = 'SELECT * FROM stgxx.vw_Titre_Thm_Aut WHERE Liv_Titre = \'' . $_GET['Liv_Titre'] . '\'';
}
elseif ($_GET['Aut_Nom'] != '') {
$requete = 'SELECT * FROM stgxx.vw_Titre_Thm_Aut WHERE Aut_Nom = \'' . $_GET['Aut_Nom'] . '\'';
}
elseif ($_GET['Aut_Prenom'] != '') {
$requete = 'SELECT * FROM stgxx.vw_Titre_Thm_Aut WHERE Aut_Prenom = \'' . $_GET['Aut_Prenom'] . '\'';
}
elseif ($_GET['Thm_Libel'] != '') {
$requete = 'SELECT * FROM stgxx.vw_Titre_Thm_Aut WHERE Thm_Libel = \'' . $_GET['Thm_Libel'] . '\'';
}

//on récupère les valeurs des diffèrent champs pour chaque message
$rep =$oPdo->query($requete);
$donnees = $rep->fetchall();

echo'<table border="1" align="center">
<tr>
<th>Livre ISBN</th>
<th>Livre Titre</th>
<th>Auteur Nom</th>
<th>Auteur Prénom</th>
<th>Thème</th>
<th>Réserver</th>
</tr>';

foreach ($donnees as $row) {
echo'<tr>
<td align="center">'.$row['Liv_Isbn'].'</td>
<td align="center">'.$row['Liv_Titre'].'</td>
<td align="center">'.$row['Aut_Nom'].'</td>
<td align="center">'.$row['Aut_Prenom'].'</td>
<td align="center">'.$row['Thm_Libel'].'</td>
<td><input type="submit" name="submit" value="Oui" class="button" >.</td>
</tr>';
}
echo'</table>';
}
?>
sousatoufi
New php-forum User
New php-forum User
 
Posts: 1
Joined: Thu Jan 30, 2014 6:09 am

Return to PHP coding => General

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron