marlboro Posted October 19, 2008 Report Share Posted October 19, 2008 labdien esu izveidojis "textarea" kura ierakstitais texts pec pogas nospieshanas - "Saglabāt" tiek saglabats DB konkreta tabulaa PIEMERS : <form name="form1" method="post" action="update.php"> Ievadi lapas saturu :<br><textarea rows="10" cols="60" name="Saturs1"><?php echo "$Saturs1" ?></textarea> <input type="submit" name="Submit" value="Saglabāt"> </form> </body> </html> velos bet isti nesaprotu ka lai izveido kipa "list menu" kura ir piem Saturs1 Saturs2 , izveloties Saturs1 es varu ieraxtiit tekstu tabulaa 1 ,izveloties Saturs2 varu ierakstit tabula2 ? ka isti tas butu jataisa ? Link to comment Share on other sites More sharing options...
Grey_Wolf Posted October 19, 2008 Report Share Posted October 19, 2008 marlboro --> izmanto IF/ELSE iespeejas .... Link to comment Share on other sites More sharing options...
marlboro Posted October 19, 2008 Author Report Share Posted October 19, 2008 varbut luduz varetu kadu piemeru paradiit... ? Link to comment Share on other sites More sharing options...
p4F Posted October 19, 2008 Report Share Posted October 19, 2008 if(darbiba){ }else{ } pietiks ? Link to comment Share on other sites More sharing options...
marlboro Posted October 20, 2008 Author Report Share Posted October 20, 2008 Kur klūda ? PRicnipa saturu vinsh man izdruka bet kad parsledzu uz saturs2 nekas nemainas... ko daru nepareiiz ? <form name="form1" method="post" action="updatePage.php">Izvēlies lapu : <select name="select"> <option value="<?php $x = 1; ?>">saturs1</option> <option value="<?php $x2 = 2; ?>">saturs2</option> </select> <br><textarea rows="10" cols="60" name="contents"> <?php $saturs_x = $x; if($saturs_x == 1){ echo "$contents"; }else{ echo "nau!!"; } ?> </textarea> <input type="submit" name="Submit" value="Saglabāt"> </form> Link to comment Share on other sites More sharing options...
Java Posted October 20, 2008 Report Share Posted October 20, 2008 Protams, ka nekas nenotiek, jo kods ir neloģisks un galīgi garām... Vispirms izskaidro ideju... Link to comment Share on other sites More sharing options...
Java Posted October 20, 2008 Report Share Posted October 20, 2008 Uzraksti sekojoši: <form name="select_content" method="get" id="select_content"> Izvēlies lapu : <select name="lapa" onchange="document.forms['select_content'].submit();"> <option value="1">saturs1</option> <option value="2">saturs2</option> </select> </form> <form name="form1" method="post" action="updatePage.php"> <br><textarea rows="10" cols="60" name="contents"> <?php $saturs_x = (int)$_GET['lapa']; if($saturs_x == 1){ echo "$contents"; }else{ echo "nau!!"; } ?> </textarea> <input type="submit" name="Submit" value="Saglabāt"> </form> Link to comment Share on other sites More sharing options...
marlboro Posted October 20, 2008 Author Report Share Posted October 20, 2008 ok, paldies, ar to tad vis arii ir skaidrs bet ka lai noversh tadu lietu ka kad izvelos - saturs2 tiek ieaadeets saturs 2 bet list/menu radas saturs1 ... lidz ar to tiek liegta ispeja parslegties uz saturs1 Link to comment Share on other sites More sharing options...
Java Posted October 21, 2008 Report Share Posted October 21, 2008 Pamaini koda augšdaļu uz: <?php $select_opts = array(1,2); if ($_GET['lapa']) { $lapa = (int)$_GET['lapa']; } else { $lapa = 0; } if (!ins_array($lapa, $select_opts)) $lapa = 0; ?> <form name="select_content" method="get" id="select_content"> Izvēlies lapu : <select name="lapa" onchange="document.forms['select_content'].submit();"> <option value="0" <?php if ($lapa==0) echo 'selected';?>></option> <option value="1" <?php if ($lapa==1) echo 'selected';?>>saturs1</option> <option value="2" <?php if ($lapa==2) echo 'selected';?>>saturs2</option> </select> </form> Link to comment Share on other sites More sharing options...
marlboro Posted October 21, 2008 Author Report Share Posted October 21, 2008 hmm . nu kad salieku tavu doto piemeru kopa ar ieprieksh mineeto nekas nedarbojas :( <?php $select_opts = array(1,2); if ($_GET['lapa']) { $lapa = (int)$_GET['lapa']; } else { $lapa = 0; } if (!ins_array($lapa, $select_opts)) $lapa = 0; ?> <form name="select_content" method="get" id="select_content"> Izvēlies lapu : <select name="lapa" onchange="document.forms['select_content'].submit();"> <option value="0" <?php if ($lapa==0) echo 'selected';?>></option> <option value="1" <?php if ($lapa==1) echo 'selected';?>>saturs1</option> <option value="2" <?php if ($lapa==2) echo 'selected';?>>saturs2</option> </select> </form> <form name="form1" method="post" action="updatePage.php"> <br><textarea rows="10" cols="60" name="contents"> <?php $saturs_x = (int)$_GET['lapa']; if($saturs_x == 1){ echo "$contents"; }else{ echo "nau!!"; } ?> </textarea> <input type="submit" name="Submit" value="Saglabāt"> </form> Link to comment Share on other sites More sharing options...
Aleksejs Posted October 21, 2008 Report Share Posted October 21, 2008 Un nedarbošanās izpaužās kā ...(ieraksti nedarbošanās simptomus/aprakstu šeit). Link to comment Share on other sites More sharing options...
marlboro Posted October 21, 2008 Author Report Share Posted October 21, 2008 Lūdzu nevajag taisīt muļķīgas QUOTEs nedarbojas taa ka uz servera atspogulojas vienkarshi balta(tuksha) lapa... Link to comment Share on other sites More sharing options...
bubu Posted October 21, 2008 Report Share Posted October 21, 2008 Pašā skritpa sākumā uzraksti: ini_set("display_errors", true); error_reporting(E_ALL); Link to comment Share on other sites More sharing options...
marlboro Posted October 21, 2008 Author Report Share Posted October 21, 2008 Fatal error: Call to undefined function ins_array() shinii rindaa kluuda - if (!ins_array($lapa, $select_opts)) Link to comment Share on other sites More sharing options...
bubu Posted October 21, 2008 Report Share Posted October 21, 2008 Un kurš no vārdiem "undefined" un "function" tev nav skaidrs? Link to comment Share on other sites More sharing options...
Recommended Posts