keissfootball Posted October 2, 2005 Report Share Posted October 2, 2005 Vai man kāds varētu palīdzēt vēlreiz, sāku jau mācīties, bet drusku kaut kas nesanāk manis veidotajā lapā: 84.237.157.15/index.php , re ir source kods: http://paste.php.lv/2612. Man tajā sākumā redzams augšā pa kreisi no banera "Notice", kas pilns skan "Notice: Undefined index: id in D:\webserver\Apache2\htdocs\index.php on line 3". Savukārt, kad atveru piemēram http://84.237.157.15/index.php?id=jaunumi vai http://84.237.157.15/index.php?id=info, tad tas notice pazūd. Vai nevarētu izskaidrot kas par lietu??? P.S. Man ir mainīgā IP adrese, tapēc, ja peikļuve lapai nav iespējama, ziņojiet forumā. Link to comment Share on other sites More sharing options...
lame Posted October 2, 2005 Report Share Posted October 2, 2005 $id=$_GET['id']; vietā if(isset($_GET['id'])) $id = $_GET['id']; else $id = 'jaunumi'; Pirms lietot kaut ko no $_GET[], $_POST utt. pārbaudi, vai tāds elements eksistē. Link to comment Share on other sites More sharing options...
Delfins Posted October 2, 2005 Report Share Posted October 2, 2005 function getVar( $varName, $defValue=false ) { return ( empty($_GET[$varName]) ) ? $defValue : $_GET[$varName]; } Link to comment Share on other sites More sharing options...
keissfootball Posted October 2, 2005 Author Report Share Posted October 2, 2005 Tnx, ka palīdzēji Lame, bet man drusku neskaidrs kāpēc tas kods tāds, vai tad nevar iztikt vienkārši ar GET 'id'??? Tikko pamanīju delfina atbildi, delfin vai tam lames koda variantam ir liela starpība starp tavējo koda variantu? Link to comment Share on other sites More sharing options...
bubu Posted October 2, 2005 Report Share Posted October 2, 2005 (edited) Padomā kas notiek (un kad tas notiek), ja nav 'id' elementa _GET masīvā! Edited October 2, 2005 by bubu Link to comment Share on other sites More sharing options...
keissfootball Posted October 2, 2005 Author Report Share Posted October 2, 2005 1. viņš tjipa pārbauda vai elements id eksistē Link to comment Share on other sites More sharing options...
LorDRameX Posted October 2, 2005 Report Share Posted October 2, 2005 1. viņš tjipa pārbauda vai elements id eksistē 23692[/snapback] nope viņš nezin ko darīt īsti ;) Link to comment Share on other sites More sharing options...
keissfootball Posted October 2, 2005 Author Report Share Posted October 2, 2005 ko? :blink: Link to comment Share on other sites More sharing options...
LorDRameX Posted October 2, 2005 Report Share Posted October 2, 2005 ko? :blink: 23694[/snapback] nu tas par to ko un kas notiek ja nav id elementa ieksh GET masiiva PHP laaga nezini ko dariit un taadelj pirms izmantot elementu vajag parbaudiit vai id elements eksistee un ja nee tad uzstaadiit kaadu nokluseeto veertiibu Link to comment Share on other sites More sharing options...
keissfootball Posted October 2, 2005 Author Report Share Posted October 2, 2005 nu a ko es teicu???? :blink: Link to comment Share on other sites More sharing options...
bubu Posted October 2, 2005 Report Share Posted October 2, 2005 (edited) keissfootball, nu nepareizi tu teici. Skaties pats: $_GET = array('abc' => 'kautkas1', 'xxx' => 'kautkas2'); echo $_GET['id']; Ko lai tas echo izvada, ja iekš _GET nemaz tāda id nav? Atbilde: protams, ka kļūdu. Tev jāpārliecinās vai tāds id tur ir, pirms izvadīt: echo (isset($_GET['id']) ? $_GET['id'] : 'nav tāda id'); Edited October 2, 2005 by bubu Link to comment Share on other sites More sharing options...
Zoom Posted October 2, 2005 Report Share Posted October 2, 2005 (edited) intreses pec... http://www.webpage-maker.com/ tu sos softu izmanto majas lapas taisisanai? http://3a3-interactive.net/php_reference/#1.9.2 Nav ertak? edit: Vai man acis kubā no lauku āboliem, bet es tur neredzēju 275 rindiņu <_< Edited October 2, 2005 by Zoom Link to comment Share on other sites More sharing options...
nemec Posted October 2, 2005 Report Share Posted October 2, 2005 man patiik tas keks no LFKA, kaa tu vinjiem iestaastiiji, ka rubij no weba kaut ko?? ar taadiem tempiem peec pus gada gan jau buus gatavs kaads caurumains meesls... skatos uz tavaam 275 rindinjaam un briinos: kur tik daudz visaadas hujnjas var sabaazt vienaa. tu labaak atver NotePadu, pamaacies HTML un tikai tad kjeries pie PHP. Un tad to pashu dabuusi gatavu ne ar 275, bet ar 27 rindinjaaam.... pat domains nopirkts. mjaa .. personal: cik vinji tev samaksaaja un kad tev jaapabeidz tas sviesc??? Link to comment Share on other sites More sharing options...
bubu Posted October 2, 2005 Report Share Posted October 2, 2005 http://3a3-interactive.net/php_reference/#1.9.2Nav ertak? 23701[/snapback] Atkarīgs no situācijas. Link to comment Share on other sites More sharing options...
keissfootball Posted October 2, 2005 Author Report Share Posted October 2, 2005 (edited) Man tīri labi patīk dizains, un man pofig cik tur rindiņām vajag būt, nedomāju, ka kāds skatās rindiņas un pēc tā arī spriež mājaslapu!!! P.S Sākumā tika taisīts uz webpage-makera, tāpēc tā pagaidām ir tikai testa lapa, ja protams māki lasīt, a kas? edit: Nemec girbētos tavus darbus redzēt, lai inātu kādām tad lapām jāizskatās???!!! Edited October 2, 2005 by keissfootball Link to comment Share on other sites More sharing options...
Recommended Posts