aniqlanmaydigan indeks: birinchi qatorda C: \ wamp64 \ www \ Form \ addtodatabase.php 12-satrda xato

Form.html deb nomlangan sahifa mavjud. Bu sahifa addtodatabase.php sahifasiga yo'naltiriladi oxirida tugma bor.

    <form action="addtodatabase.php" method="post">
    <form class="form-inline">
    
Security Department User Registration <div class="form-group"> <input type="text" class="form-control" id="Firstname" name="firstname" placeholder="Text input">
</div> <div class="form-group"> <input type="text" class="form-control" id="Secondname" name="secondname" placeholder="Text input">
</div> </form>

Mening addtodatabase.php sahifam.

    $connect=mysqli_connect('localhost','root','','form_db');
    if(mysqli_connect_errno($connect))
    {
    echo 'Failed to connect:'.mysqli_connect_error();
    }
    $firstname=""; 
    $secondname="";
    if (isset($_POST)) { 
    $firstname  = isset($_POST['firstname']) ? $_POST['firstname'] : '';
    $secondname = isset($_POST['secondname']) ? $_POST['secondname'] : '';
    echo 'Your first name is ' .$firstname. '
'; echo 'Your second name is ' .$secondname. '
'; }

Uchta xato mavjud

addtodatabase.php sahifasiga kirmaydi.    http://localhost: 8080/form/form.html .   Eslatma: Belgilangan katalog: birinchi nom 12-satrda C: \ wamp64 \ www \ Form \ addtodatabase.php.   ma'lumotlar bazasiga hech narsa qo'shilmaydi. faqat id soni oshiriladi

Oldindan rahmat.

0
$ firstname = $ _ POST ["firstname"];//o'zgarmaydiganni ishga tushirish uchun $ secondname = $ _ POST ['secondname'];//agar (isset ($ _ POST)) o'zgaruvchini ishga tushirishga harakat qilinsa {$ firstname = $ _ POST ['ism']; $ secondname = $ _ POST ["ikkinchi ism"];
qo'shib qo'ydi muallif Eiman Sadath Assadi, manba
Argumentlar bo'sh qiymatlar bilan boshlang.
qo'shib qo'ydi muallif User formerly known as chris85, manba
Argumentlar bo'sh qiymatlar bilan boshlang.
qo'shib qo'ydi muallif User formerly known as chris85, manba
Agar siz u erga bormasangiz, qanday qilib xatoga yo'l qo'yasiz? Nima uchun $ firstname = $ _ POST ['firstname']; ikki marta tayinlansin?
qo'shib qo'ydi muallif User formerly known as chris85, manba
Agar siz u erga bormasangiz, qanday qilib xatoga yo'l qo'yasiz? Nima uchun $ firstname = $ _ POST ['firstname']; ikki marta tayinlansin?
qo'shib qo'ydi muallif User formerly known as chris85, manba
men sizni yuborib yubormoqchi deb o'ylayman ..
qo'shib qo'ydi muallif sunilwananje, manba
men sizni yuborib yubormoqchi deb o'ylayman ..
qo'shib qo'ydi muallif sunilwananje, manba

6 javoblar

Agar siz xabar qiymatiga kirishdan oldin, u mavjudligini tekshirib ko'ring. Shunday qilib, foydalaning

$firstname  = isset($_POST['firstname']) ? $_POST['firstname'] : '';
$secondname = isset($_POST['secondname']) ? $_POST['secondname'] : '';

almashtirish

$firstname=$_POST['firstname'];
$secondname=$_POST['secondname'];

tahrir:

$connect=mysqli_connect('localhost','root','','form_db');

if(mysqli_connect_errno($connect))
{
echo 'Failed to connect:'.mysqli_connect_error();
}


$firstname  = isset($_POST['firstname']) ? $_POST['firstname'] : '';
$secondname = isset($_POST['secondname']) ? $_POST['secondname'] : '';

echo 'Your first name is ' .$firstname. '
'; echo 'Your second name is ' .$secondname. '
'; }
0
qo'shib qo'ydi
Uni tahrir qildim. ism qo'yilganda, u nomini ko'rsatadi. agar sozlanmagan bo'lsa, hech narsa ko'rsatma.
qo'shib qo'ydi muallif Kris Roofe, manba
Kodingizda boshqa muammolar ham bo'lishi mumkin. Siz ularni topish uchun jurnaldan foydalanishingiz mumkin.
qo'shib qo'ydi muallif Kris Roofe, manba
Yuqoridagi o'zgarishlarni qaerda qo'shishim kerak? yuqoridagi isset yoki if (isset ($ _ POST) bilan)
qo'shib qo'ydi muallif Eiman Sadath Assadi, manba
Kodni yuqoridagi kodga ko'ra o'zgartirdim, bu undefined indeksdagi xatolik yo'q. Ma'lumotlar form_details qo'shilmaydi va kimligi oshirilmaydi.
qo'shib qo'ydi muallif Eiman Sadath Assadi, manba
log nima? dasturiy ta'minot yoki disk raskadrovka vositasi
qo'shib qo'ydi muallif Eiman Sadath Assadi, manba

Agar siz xabar qiymatiga kirishdan oldin, u mavjudligini tekshirib ko'ring. Shunday qilib, foydalaning

$firstname  = isset($_POST['firstname']) ? $_POST['firstname'] : '';
$secondname = isset($_POST['secondname']) ? $_POST['secondname'] : '';

almashtirish

$firstname=$_POST['firstname'];
$secondname=$_POST['secondname'];

tahrir:

$connect=mysqli_connect('localhost','root','','form_db');

if(mysqli_connect_errno($connect))
{
echo 'Failed to connect:'.mysqli_connect_error();
}


$firstname  = isset($_POST['firstname']) ? $_POST['firstname'] : '';
$secondname = isset($_POST['secondname']) ? $_POST['secondname'] : '';

echo 'Your first name is ' .$firstname. '
'; echo 'Your second name is ' .$secondname. '
'; }
0
qo'shib qo'ydi
Uni tahrir qildim. ism qo'yilganda, u nomini ko'rsatadi. agar sozlanmagan bo'lsa, hech narsa ko'rsatma.
qo'shib qo'ydi muallif Kris Roofe, manba
Kodingizda boshqa muammolar ham bo'lishi mumkin. Siz ularni topish uchun jurnaldan foydalanishingiz mumkin.
qo'shib qo'ydi muallif Kris Roofe, manba
log nima? dasturiy ta'minot yoki disk raskadrovka vositasi
qo'shib qo'ydi muallif Eiman Sadath Assadi, manba
Kodni yuqoridagi kodga ko'ra o'zgartirdim, bu undefined indeksdagi xatolik yo'q. Ma'lumotlar form_details qo'shilmaydi va kimligi oshirilmaydi.
qo'shib qo'ydi muallif Eiman Sadath Assadi, manba
Yuqoridagi o'zgarishlarni qaerda qo'shishim kerak? yuqoridagi isset yoki if (isset ($ _ POST) bilan)
qo'shib qo'ydi muallif Eiman Sadath Assadi, manba

Eslatma - Ma'lumotlarni olishdan oldin tekshirish.

Buni sinab ko'ring

 $connect=mysqli_connect('localhost','root','','form_db');

    if(mysqli_connect_errno($connect))
    {
    echo 'Failed to connect:'.mysqli_connect_error();
    }

    if (isset($_POST)) { 
    $firstname=$_POST['firstname'];
    $secondname=$_POST['secondname'];


    echo 'Your first name is ' .$firstname. '
'; echo 'Your second name is ' .$secondname. '
'; }
0
qo'shib qo'ydi

Eslatma - Ma'lumotlarni olishdan oldin tekshirish.

Buni sinab ko'ring

 $connect=mysqli_connect('localhost','root','','form_db');

    if(mysqli_connect_errno($connect))
    {
    echo 'Failed to connect:'.mysqli_connect_error();
    }

    if (isset($_POST)) { 
    $firstname=$_POST['firstname'];
    $secondname=$_POST['secondname'];


    echo 'Your first name is ' .$firstname. '
'; echo 'Your second name is ' .$secondname. '
'; }
0
qo'shib qo'ydi

form.html bilan bir xil papkada addtodatabase.php bormi?

HTML: c: \ wamp64 \ www va addtodatabase.php C: \ wamp64 \ www \ Form \ da joylashgan bo'lsa, HTMLni o'zgartiring;

<form action="Form/addtodatabase.php" method="post">
<form class="form-inline">
Security Department User Registration <div class="form-group"> <input type="text" class="form-control" id="Firstname" name="firstname" placeholder="Text input">
</div> <div class="form-group"> <input type="text" class="form-control" id="Secondname" name="secondname" placeholder="Text input">
</div> </form> <input type="submit" value="submit"> </form>
0
qo'shib qo'ydi
Opps buni ko'rmadim, kodni o'zgartirdim, Sunilga rahmat.
qo'shib qo'ydi muallif Komal Bandi, manba
ushbu formani qanday topshirasiz?
qo'shib qo'ydi muallif sunilwananje, manba

form.html bilan bir xil papkada addtodatabase.php bormi?

HTML: c: \ wamp64 \ www va addtodatabase.php C: \ wamp64 \ www \ Form \ da joylashgan bo'lsa, HTMLni o'zgartiring;

<form action="Form/addtodatabase.php" method="post">
<form class="form-inline">
Security Department User Registration <div class="form-group"> <input type="text" class="form-control" id="Firstname" name="firstname" placeholder="Text input">
</div> <div class="form-group"> <input type="text" class="form-control" id="Secondname" name="secondname" placeholder="Text input">
</div> </form> <input type="submit" value="submit"> </form>
0
qo'shib qo'ydi
Opps buni ko'rmadim, kodni o'zgartirdim, Sunilga rahmat.
qo'shib qo'ydi muallif Komal Bandi, manba
ushbu formani qanday topshirasiz?
qo'shib qo'ydi muallif sunilwananje, manba
PhP |BotsUz
PhP |BotsUz
93 ishtirokchilar

Phpni o'rganishni Hohlasangiz https://t.me/joinchat/AAAAAE-KRc5dd5tPMmGmWA A'zo bo'lin