Jump to content

Tadziz

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Tadziz's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hmm, stange i ca't edit my topic. Well, i looked better in this forum and found i think an answer. http://www.phpfreaks.com/forums/php-coding-help/help-me-to-display-enum-fields-value-in-form/ But if someone know a better way it would be nice if you share
  2. Hi, i don't understand how to show ENUM type data in php. Now i use: <input type="text" name="type" style="width: 362px; height: 35px;" value="<?php echo $type; ?>"> But it print only the value that is set to topic i see. How to display all ENUM values in radio buttons and that checked button would be that one from the topic. For example: ENUM ('city','town','vilage') . I select town when writing a topic. And when i edit data i see 3 radio buttons and TOWN would be checked. Thank you for answer. p.s maybe someone know a good site where is a tutorial how to show enum in php
  3. I have solved my problem there is how should look my redaguoti.php code. Maybe it will help someone in future <?php //prisijungiam infomacija apie duomenu bazes prisijungima include "../valdymas/conf.php"; /////////////// if(isset($_GET['irasas'])){ ///$id=$_POST["id"]; echo "<input type=\"hidden\" name=\"irasas\" value=\"".$_GET['irasas']."\" />"; $query=" SELECT * FROM irasas WHERE id='".$_GET['irasas']."'"; $result=mysql_query($query); $num=mysql_numrows($result); ///////// $i=0; while ($i < $num) { $id=mysql_result($result,$i,"id"); $idejimo_data=mysql_result($result,$i,"idejimo_data"); $redagavimo_data=mysql_result($result,$i,"redagavimo_data"); $pavadinimas=mysql_result($result,$i,"pavadinimas"); $miestas=mysql_result($result,$i,"miestas"); $tipas=mysql_result($result,$i,"tipas"); ++$i; mysql_close(); } } ?> <html> <form action="../valdymas/atnaujinti.php" method="post"> Irašo numeris: <input type="" name="id" value="<?php echo $id; ?>" readonly> Idejimo data: <input type="text" name="idejimo_data" style="width: 300px" value="<?php echo $idejimo_data; ?>" readonly> Redagavimo data: <input type="text" name="idejimo_data" style="width: 300px" value="<?php echo $redagavimo_data; ?>" readonly><br> Pavadinimas: <input type="text" name="pavadinimas" style="width: 300px" value="<?php echo $pavadinimas; ?>"><br> Miestas: <input type="text" name="miestas" style="width: 300px" value="<?php echo $miestas; ?>"><br> Tipas: <input type="text" name="tipas" style="width: 300px" value="<?php echo $tipas; ?>"><br> <input type="submit" name="atnaujinti" value="Atnaujinti"> <a href="../vartotojas/redaktorius.php" ><input type="button" value="Grįžti atgal"></a> </form> </html>
  4. Ok. I manage to find out what why it didin't show ID numbers. It was becouse this line was written bad by me this is how it should be i think: echo '<td><a href="../valdymas/redaguoti.php?irasas='.$row['id'].'">' . $row['pavadinimas'] . '</a></td>'; But now when it redirect me in redaguoti.php still say that it don't know who is ID "Undefined index: id" on line 5 . In my older post i have writtent redaguoti.php code. Maybe someone could look to it and say what is wrong. Thank you.
  5. I don't understand. I have this line: echo "<td><a href=\"../valdymas/redaguoti.php?irasas=\"".$row['id']."\">" . $row['pavadinimas'] . "</a></td>"; But i when i press on topic name it redirect me in this url http://localhost/valdymas/redaguoti.php?irasas= . But withoud ID. And it gives me error : Undefined index: id in C:\Program Files\EasyPHP-5.3.4.0\www\Tikrasis muziejaus puslapis\valdymas\redaguoti.php on line 5 Code of redaguoti.php <?php //prisijungiam infomacija apie duomenu bazes prisijungima include "../valdymas/conf.php"; /////////////// $id=$_POST['id']; $query=" SELECT * FROM irasas WHERE id='$id'"; $result=mysql_query($query); $num=mysql_numrows($result); ///////// $i=0; while ($i < $num) { $id=mysql_result($result,$i,"id"); $idejimo_data=mysql_result($result,$i,"idejimo_data"); $redagavimo_data=mysql_result($result,$i,"redagavimo_data"); $pavadinimas=mysql_result($result,$i,"pavadinimas"); $miestas=mysql_result($result,$i,"miestas"); $tipas=mysql_result($result,$i,"tipas"); ++$i; mysql_close(); } ?> <html> <form action="../valdymas/atnaujinti.php" method="post"> Irašo numeris: <input type="" name="id" value="<?php echo $id; ?>" readonly> Idejimo data: <input type="text" name="idejimo_data" style="width: 300px" value="<?php echo $idejimo_data; ?>" readonly> Redagavimo data: <input type="text" name="idejimo_data" style="width: 300px" value="<?php echo $redagavimo_data; ?>" readonly><br> Pavadinimas: <input type="text" name="pavadinimas" style="width: 300px" value="<?php echo $pavadinimas; ?>"><br> Miestas: <input type="text" name="miestas" style="width: 300px" value="<?php echo $miestas; ?>"><br> Tipas: <input type="text" name="tipas" style="width: 300px" value="<?php echo $tipas; ?>"><br> <input type="submit" name="atnaujinti" value="Atnaujinti"> <a href="../vartotojas/redaktorius.php" ><input type="button" value="Grįžti atgal"></a> </form> </html> I feels very bad, that i ask you these questions but i really don't understand how to make it work. I even don't know how to write in english what i want to google answer :/
  6. I'm new in php and i need help. I have wrote script to show that is in my mysql table called 'irasas' if(isset($_POST['ri'])){ include "../valdymas/conf.php"; $result = mysql_query("SELECT * FROM irasas"); echo " <table border='1' class='sample'> <tr> <th>Numeris duomenų bazėje</th> <th>Įrašo sukūrimo data</th> <th>Name</th> <th>Tipas</th> <th>Miestas</th> <th style=\"width: 100px\"><form method='POST' action='".$_SERVER["PHP_SELF"]."'><input type='submit' name='sumbit' value='Delete'/></form></th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td><center>" . $row['id'] . "</center></td>"; echo "<td><center>" . $row['idejimo_data'] . "</center></td>"; echo "<td><a href=\"../valdymas/edit.php?topic=\"".$id."\">" . $row['name'] . "</a></td>"; echo "<td>" . $row['tipas'] . "</td>"; echo "<td>" . $row['miestas'] . "</td>"; echo "<td style=\"width: 50px\"><center><input type=\"checkbox\" name=\"deleted_items[]\" </center>"; echo "</tr>"; } echo '</table>'; $display_block='<form method="POST" action="../valdymas/edit.php"> <table> <col span="1" align="right"> <tr> <td><font color="blue">Enter number you want to edit:</font></td> <td><input type="text" name="id" size="50"></td> </tr> <tr> <td><input type="submit" name="sumbit" value="Edit"/></td> </tr> </table> </form>'; Now if i want to edit topic i have to enter ID of topic, and then i press EDIT, and open new page with all info and i can edit. But i wan to make that users and i don't need to enter numbers, but just press on topic name in table. As you can see here i tryed something to do, but... i don't have enought experience in php. echo "<td><a href=\"../valdymas/edit.php?topic=\"".$id."\">" . $row['name'] . "</a></td>"; And sorry if i had written something wrong , english is not my native language. Thank you for answer.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.