Phorum.ro
Your Avatar Welcome to Phorum.ro!
If you haven't registered yet, click here!
Attention Visitor:
You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.
Du-te înapoi   Phorum.ro > Web Design & Web Development > Programare > PHP > Discutii Generale

Discutii Generale Discutii generale despre PHP.

Răspunde
 
Thread Tools Moduri de afișare
Vechi 16.05.2009   #1
marianchucky
16-Bit Member
 
Data înregistrării: 16.07.2008
Mesaje: 18
Rep Power: 4
marianchucky is on a distinguished road
Exclamation script comparare

Salut!

Am nevoie urgent de un script pentru a compara, nu am timp pentru a-l face si nici nu am gasit nimic pe google. Sa fiu mai explicit... de ex:eu intr-un website am o lista intreaga de credite. In dreapta fiecarui credit este un checkbox. Prin check-uirea a 2 sau mai multe credite si actionarea unui buton din susul paginii (butonul compare), vreau sa ajung la o alta pagina unde sa imi apara toate creditele selectate si celelalte informatii ale lor. Toate informatiile pentru fiecare credit sunt introduse intr-o baza de date mysql.

Daca mi-ati fi de ajutor as fi foarte recunoscator!

Multumesc anticipat!
__________________
Portal economic - http://www.ebancomat.ro
marianchucky is offline   Reply With Quote
Sponsored Links
Vechi 18.05.2009   #2
marianchucky
16-Bit Member
 
Data înregistrării: 16.07.2008
Mesaje: 18
Rep Power: 4
marianchucky is on a distinguished road
Implicit

nu stie nimeni unde as putea gasi un asemenea script?
sau daca a mai folosit cineva acest gen de script ma poate ajuta va rog frumos?

Multumesc anticipat!
__________________
Portal economic - http://www.ebancomat.ro
marianchucky is offline   Reply With Quote
Vechi 14.10.2009   #3
M1Sh0u
8-Bit Member
 
Data înregistrării: 10.03.2006
Locație: Constanta, Romania
Mesaje: 1
Rep Power: 6
M1Sh0u is on a distinguished road
Implicit Nu este greu deloc

Scriptul este ceva de genul asta:

afisare.php:

Cod PHP:

$sql 
mysql_query("SELECT * FROM Produse");
if(
mysql_num_rows($sql) == 0) {
  echo 
'Nici un produs adaugat !';
} else {
  echo 
'<form action="/compara.php" method="post">';
  while(
$row mysql_fetch_array($sql)) {
    echo 
'<input type="checkbox" name="produse[]" id="produs-'  .$row['IDProdus'] . '" value="' $row['IDProdus'] . '" /> <label for="produs-' .$row['IDProdus'] . '">' $row['TitluProdus'] . '</label>';
  }
  echo 
'<input type="submit" name="compara" value="Compara" /></form>';

compara.php:

Cod PHP:

if(isset($_POST['compara'])) {
  if(
count($_POST['produse']) > 0) {
    
    echo 
'<table cellpading="1" cellspacing="1" border="0"><tr>';
    for(
$i 0$i count($_POST['produse']); $i++) {
      
$sql mysql_query("SELECT * FROM Produse WHERE IDProdus='" $_POST['produse'][$i] . "'");
      
$row mysql_fetch_array($sql);
      echo 
'<td>' $row['TitluProdus'] . '' $row['DescriereProdus'] . '' $row['SpecificatiiProdus'] . '</td>';
    }
    echo 
'</tr></table>';
  } else {
   echo 
'Nu ati adaugat nici un produs la comparatie !';
  }

} else {
  echo 
'Calea catre aceasta pagina este incorecta !';

Acest cod este unul simplist dar care te poate ajuta sa-ti dai seama cum ai putea sa faci acest script de comparatie. Poate fi folosit si adaptat dupa preferintele tale
M1Sh0u is offline   Reply With Quote
Răspunde


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Moduri de afișare

Reguli de postare
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Pornit
emoticoanele sunt Pornit
Codul [IMG] este Pornit
Codul HTML este Pornit



Ora este GMT +3. Ora este acum 16:07:18.


Rulează cu: vBulletin Version 3.8.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Forum SEO by Zoints

XXXXXXXXXXXXXXXXXXX
Inactive Reminders By Icora Web Design