🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: be.comp.programming
Article #2623

Re: Q : php formcontrol problem

#2623
From: Joris Janssens
Date: Thu, 01 Apr 2004 17:00
39 lines
2203 bytes
"snk00sj" <snk00sj@digitalbase.be> wrote in
news:406c4212$0$2008$ba620e4c@news.skynet.be: 

> Ik heb een html form die post naar file1.php, op die html form staan
> 50 textboxen
> 
> namen : d50_1 --> d50_50
> 
> in de file1.php wil ik checken of er in 1 van al die textboxjes
> (afkomstig van de html form), er ergens een "[" of "]" string aanwezig
> is 
> 
> ik maak met een for lus een loop van 50
> 
> $nr_d = 50;
> for ($i = 0 ; $i<=50 ; $i++) {
>         if ( substr_count('$d".$nr_d."_".$i.',"[")>0 ) { echo "HAAKJES
> GEVONDEN !!" }
> }

als je al die textboxjes dezelfde naam geeft, dan komen die als een array 
in $_POST terecht

if (isset($_POST['d50']) and isarray($_POST['d50'])) {
  foreach($_POST['d50'] as $textbox) {
    //controleer of $textbox een haakje bevat
  }
}

als je wil weten welke textbox het was, kan je een gewone for-loop 
gebruiken natuurlijk



-- 
Joris "flotspe" Janssens
http://www.xhtml.be/inferno/
 A: Because it messes up the order in which people normally read text.
 Q: Why is top-posting such a bad thing?
Technical Details
Message-ID: <Xns94BEC150D1B50flotspexhtmlinvalid@195.130.132.70>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsgate.cistron.nl!aotearoa.belnet.be!news.belnet.be!ossa.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mail
References: <406c4212$0$2008$ba620e4c@news.skynet.be>

Show Full Headers
Complete Article Headers
X-Google-Language: DUTCH,ASCII-7-bit
X-Google-Thread: fcea4,c093a7576c618f77
X-Google-Attributes: gidfcea4,public
X-Google-ArrivalTime: 2004-04-01 09:00:12 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsgate.cistron.nl!aotearoa.belnet.be!news.belnet.be!ossa.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mail
Newsgroups: be.comp.programming
Subject: Re: Q : php formcontrol problem
From: Joris Janssens <flotspe@xhtml.invalid>
References: <406c4212$0$2008$ba620e4c@news.skynet.be>
Organization: xhtml.be
Message-ID: <Xns94BEC150D1B50flotspexhtmlinvalid@195.130.132.70>
User-Agent: Xnews/5.04.25
X-face: 4g-O{>F:+'.3ph1z[9ONr|b'uCf!^VyQ11M?}XC+nQ=DLVn`E2{&F>eQ@0"ANkivp>3e{Ft<WCE>fKWVSO8d_b^M-9nC>2<WsD;R2)s~No+p21I9M@VM~Ei2uw?DGaa"l-:rl|E]IY0*YjGP*FnvOpg!Hm*w(216S;,gqz0=)YMN!H'iMKdlt/
Reply-To: flotspe@xhtml.be
Lines: 39
Date: Thu, 01 Apr 2004 17:00:11 GMT
NNTP-Posting-Host: 213.224.68.229
X-Complaints-To: abuse@telenet.be
X-Trace: phobos.telenet-ops.be 1080838811 213.224.68.229 (Thu, 01 Apr 2004 19:00:11 MEST)
NNTP-Posting-Date: Thu, 01 Apr 2004 19:00:11 MEST