Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Web Development
You last visited: Today at 15:41

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



PHP Schleife, Button, Variable Zuweisung und Ausgabe

Discussion on PHP Schleife, Button, Variable Zuweisung und Ausgabe within the Web Development forum part of the Coders Den category.

Reply
 
Old   #1
 
ChilloutFuzi's Avatar
 
elite*gold: 217
Join Date: Mar 2012
Posts: 413
Received Thanks: 53
PHP Schleife, String

Hey
Ich hab eine Schleife in php in der Buttons erzeugt werden.
Jeder Button bekommt auch eine Funktion wenn man auf den Button klickt wird $offers $bez hinzugefügt (zumindest sollte) und danach sollen dann alle auf gelistet , aber ich hab kein plan wie.
Schleife aktuell:
PHP Code:
        <form action="<?php $_SERVER['PHP_SELF'?>" method="post">
<?php
    $n 
0;
    
$offers "";
foreach(
$items as $item) {
    
$bez $item["market_hash_name"];
    if(@
$item["icon_url_large"]) {
        
$hash str_replace("+""%20"urlencode($item["market_hash_name"]));
        echo 
"<input type='submit' "
        if(
substr($item["name"], 04) == "Stat") {
            echo 
" StatTrak ";
        }
        if(
substr($item["market_hash_name"], 04) == "Stat") {
            
$stat substr($item["market_hash_name"], 11);
            
$bez "StatTrak".$stat;
        }
        else {
            
$bez $item["market_hash_name"];
    }    
    
        echo 
" name='btn".$n."' value='".$bez."' title='".$bez."'alt='".$bez."'/>";
        if (isset(
$_POST["btn".$n])) 
        { 
            
$offers .= $bez;
        }
    } else {
        echo 
"<!--Item has no image-->";
    }
    
$n++;
}
echo 
$offers;
ChilloutFuzi is offline  
Old 02/10/2015, 22:58   #2



 
Serraniel's Avatar
 
elite*gold: 0
The Black Market: 205/1/0
Join Date: May 2010
Posts: 6,853
Received Thanks: 5,106
Hab das genaue Problem nicht verstanden jetzt aber damit machst du dir auf jedenfall das HTML kaputt:

PHP Code:
echo "<input type='submit' ";  
        if(
substr($item["name"], 04) == "Stat") { 
            echo 
" StatTrak "
        } 
Buttons von einer For Schleife erzeugen kannst du z.B. so:

PHP Code:
<?php
    
foreach($items as $item)
    {    
        
$value 'DEFAULT';
        
// Tue irgendetwas intelligentes um $value zu bestimmen
        
        
if(ShowButtonCondition)
        {
            echo 
'<input type="submit" value="'.$value.'">';
            
//Beachte das der Button eine JS Funktion oder ein Formular braucht um auch wirklich funktional zu sein.
        
}
    }
?>
Von einer Funktion an den Buttons seh ich bei dir nichts.
Serraniel is offline  
Thanks
1 User
Old 02/11/2015, 06:59   #3
 
ChilloutFuzi's Avatar
 
elite*gold: 217
Join Date: Mar 2012
Posts: 413
Received Thanks: 53
Als ich diesen Post gemacht habe hat sich das Problem gelöst und ein neues ist entstanden heute mittag poste ich nochmal meinen aktuellen Code
ChilloutFuzi is offline  
Reply

Tags
button funktion, php, schleife


Similar Threads Similar Threads
Autoit Variable Button Addieren
11/17/2014 - AutoIt - 3 Replies
Hi leute, ich habe ein eigentlich ziemlich lächerliches Problem. Ich habe mir bei Autoit meine Gui gebaut und möchte jetzt z.B. jedesmal wenn Button1 gedrückt wird die Variable $1 um einen erhöhen also quasi Druck1($1=1) Druck2 ($2=2) Druck3 ($3=3) usw. wie kann ich das anstellen? Im Internet finde ich das ganze immer nur mit For Schleife und dann hoch zählen aber ich will ja nur auf den Button druck zählen... vielen dank für die Antwort
[Python] Jeder Button macht die gleiche Ausgabe
06/25/2014 - Metin2 Private Server - 1 Replies
Hier der Ausschnitt hab auch die Definition von "Kategorie" mal hingeschrieben Kategorie = {} def AddKategorie(self,string): x=30 y=45 split = string.split("|") for i in range(len(split)-1):
Variable in ProcessExist Shellexecute schleife
06/19/2013 - AutoIt - 3 Replies
Moin! Wie kann man denn bitte eine Variable für eine solche Schleife benutzen: Case $Select $Launcher = FileOpenDialog("Select your AA Launcher exe",@UserName & "\Desktop", "Applications (*.exe)",1 + 2) Case $restart EndSwitch If $bCheck Then If Not ProcessExists($Launcher) And Not ProcessExists("bf3.exe") Then ;~ Run(@DesktopDir & "\BlaueKugel.exe")
While schleife beenden mit Button
02/14/2012 - AutoIt - 5 Replies
Erst mal Abend leute:) Und hier schon mein Problem: Ich weiß wie man eine While schleife beenden mit ExitLoop. Aber wie beende ich es mit einem anderen button?



All times are GMT +1. The time now is 15:42.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.