簡體   English   中英

添加和編輯相同形式的php

[英]add and edit in the same form php

我有此代碼:

<?php
////////////////////////////////////////
include "../includes/site_includes.php";//
//////////////////////////////////////
$sql = getallsitesettings();
if ($result = $mysqli->prepare($sql)) 
{
$rekza = 1;
$result->bind_param("i",$rekza);
$result->execute(); 
$result->store_result();
$rowsZ = $result->num_rows;
}
if($rowsZ>0)
{
$row = fetch($result);
}
$siteTitle= $row[0]["site_title"];
$sitePeleText= $row[0]["pele"];
?>
<?php

$act = $mysqli->real_escape_string($_GET["act"]);
if($act=="edit")
{
    $folderid = (int)$_GET["id"];
    $sql2 = getfolderbyId();
    if ($result2 = $mysqli->prepare($sql2)) 
    {
    $result2->bind_param("i",$folderid);
    $result2->execute();    
    $result2->store_result();
    $rowsZ2 = $result2->num_rows;
    }
    if($rowsZ2>0)
    {
    $row2 = fetch($result2);
    }
    for($j=0; $j<$rowsZ2; $j++) 
        {
    $foldername = $row2[$j]["fold_name"];
    $foldpath = $row2[$j]["fold_path"];
    $foldpic = $row2[$j]["fold_pic"];
        }
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html dir="rtl">
 <head>
  <title><?=$txt_folders?></title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="Generator" content="EditPlus">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <link href="<?=$site_url?>/css/styles.css" rel="stylesheet" type="text/css" />
 </head>
    <table align="center" cellspacing="0" cellpadding="0" width="1021">
        <tr>
            <td><?php
            include "../site_header.php";
            ?></td>
        </tr>
        <tr>
            <td style="background-color:#dcdbdb;">
                    <table align="center" cellspacing="0" cellpadding="0" width="1021">
                        <tr>
                            <td>
                                <div class="admintitle">
                                <a href="../main.php" style="color:black; text-decoration:none;"><?=$txt_main_admin?></a> > <?=$txt_folders?>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <table align="center" cellspacing="0" cellpadding="0" width="400">
                                    <tr>
                                        <td style="color:Black; font-family:arial; font-weight:Bold;"><?=$txt_folders_name?></td>
                                        <td style="color:Black; font-family:arial; font-weight:normal;"><input type="textbox" name="fold_name" value="<?=$foldername?>" /></td>
                                    </tr>
                                    <tr>
                                        <td style="color:Black; font-family:arial; font-weight:Bold;"><?=$txt_folder_path?></td>
                                        <td style="color:Black; font-family:arial; font-weight:normal;"><input type="textbox" name="fold_path" value="<?=$foldpath?>" /></td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td colspan="2"></td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
            </td>
        </tr>
        <tr>
            <td><?php
            include "../site_footer.php";
            ?></td>
        </tr>
    </table>
 <body>
 </body>
</html>

...你能告訴我什么問題嗎? 為什么當act =在輸入中將value =“”中的變量添加為未定義?....以及如何在編輯和添加中定義它們...在添加中我需要將它們為空...編輯效果很好...

也許...

if($act=="edit" || $act=="add")

:)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM