This topic is locked

New button in list page

9/29/2009 12:40:39 PM
PHPRunner General questions
U
uzu1302 author

Hello, thank you for previous answers.

I have another question.

I created a button by following an example of the Forum:

<INPUT class=button onclick="frmAdmin.a.value='calcul'; frmAdmin.submit(); return false;" value="Calcul Prix" type=button></SPAN>



---> I think the event OnClic is not good!?

My code:

global $sem;

if(@$_REQUEST["a"]=="calcul")

{

$where = "Semaine 40";

$sql = "select * from offre1 where semaine='$where'";

db_exec($sql,$conn);

}



I would like to run a query when you click on this button.

where do I put the code?
thank you again for the help

Patrick

J
Jane 9/30/2009

Patrick,
this code works in the List page: Before delete event on the Events tab only.

Please give me more detailed description of what you want to achieve.

U
uzu1302 author 9/30/2009



Patrick,
this code works in the List page: Before delete event on the Events tab only.

Please give me more detailed description of what you want to achieve.


Hello Jane

I found the solution, I said to those who need <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=44393&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />
In HTML editor List page before {BEGIN delete_link}:

<SPAN class=buttonborder> <INPUT class=button onclick="window.location.href='offre1_list.php?editid1={$show_key1}&amp;new_offre=yes';" value="Nouvelle Offre" type=button></SPAN>



In List page : Before SQL query:

if ($_REQUEST["new_offre"]=="yes")

{

global $conn, $sem, $sem2;

$jour = now();

$where = $sem;

echo $where;

echo "<script>if(!confirm('Confirmer le changement de semaine ?')){window.location.href='offre1_list.php?a=return'}</script>";

$sql = "update offre1 set semaine='$sem2', date='$jour'";

db_exec($sql,$conn);
$sql = "insert into archive (id_Of, Fournisseur, Date, Semaine, Qte, Type, Produit, Calibre, Certif, Origine, Colis, Unit, Prix_V, Coment, Prix_A, Prix_Aex, Prix_V2, Coef, Info)

select id_Of, Fournisseur, Date, Semaine, Qte, Type, Produit, Calibre, Certif, Origine, Colis, Unit, Prix_V, Coment, Prix_A, Prix_Aex, Prix_V2, Coef, Info

from offre1";

db_exec($sql,$conn);

}



Again thank you

Patrick