Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8005915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:20:47+00:00 2026-06-04T17:20:47+00:00

Hello i am having problems with my first php project which i am doing

  • 0

Hello i am having problems with my first php project which i am doing to teach my self a bit about it.So i made a form here is code:

vpis.html

<html>
    <head>
        <title>Php-Web Page - Input</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
        <div id="glava">
            <center>Php Spletna Stran</center>
            <hr/>
        </div>

        <div id="menu">
            <center>
                <a href="index.php">NAZAJ</a>
                <a href="bris.html">BRISANJE</a>
            </center>
            <hr/>
        </div>

        <div id ="vsebina">

            <div div="vpisigr">
                <form action="insert.php" method="post">
                    Vpisovanje igralca<br/>
                    ID:<input type="text" name="pid" size="20"/><br/>
                    Ime:<input type="text" name="pime" size="20"/><br/>
                    Priimek:<input type="text" name="ppriimek" size="20"/><br/>
                    Starost:<input type="text" name="pstarost" size="20"/><br/>
                    Velikost:<input type="text" name="pvelikost" size="20"/><br/>
                    Polozaj:<input type="text" name="ppolozaj" size="20"/><br/>
                    ID Kluba:<input type="text" name="ppid" size="20"/><br/>
                    <input type="submit" value="Shrani"/>
                    <input type="reset" value="Reset"/>
                </form>
            </div>
        </div>

        <hr/>

        <div id="footer">
            <center>Vse pravice pridržane </center>
        </div>
    </body>
<html>

So here i require from user to enter all data to insert into database. Here is screenshoot of database:

Database image

and here is insert.php which is called as form action

<?php
header("Content-type: text/html; charset=utf-8");
$con = mysql_connect("localhost","username","pass");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("php", $con);
//hmmmm ne dela
$sql="INSERT INTO Igralec (iID, iIME, iPRIIMEK, iSTAROST, iVELIKOST, iPOLOZAJ, ID)
VALUES ('$_POST[pid]', '$_POST[pime]', '$_POST[ppriimek]', '$_POST[pstarost]', '$_POST[pvelikost]', '$_POST[ppolozaj]', '$_POST[ppid]')";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }

//die(print_r($_POST));
echo "Dodana je ena nova vrstica";


mysql_close($con);
?> 

The problem is thath evry time i submit data, it writes false data into database all in format like
0–0-0-00 or simmilar to thath. But in array before is written it contains correct data but somehow it writes in database false data.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T17:20:49+00:00Added an answer on June 4, 2026 at 5:20 pm

    Try editing your $sql variable to this:

        $sql="INSERT INTO Igralec (iID, iIME, iPRIIMEK, iSTAROST, iVELIKOST, iPOLOZAJ, ID)
    VALUES ('".$_POST[pid]."', '".$_POST[pime]."', '".$_POST[ppriimek]."', '".$_POST[pstarost]."', '".$_POST[pvelikost]."', '".$_POST[ppolozaj]."', '".$_POST[ppid]."')";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I'm having problems sending arrays, structs and arrays of structs from PHP to
I'm having problems embedding php inside an html file. I first ran in to
Hello I am new at Haskell and i'm having problems trying to get this
Hello I am a new user to Python and I am having problem doing
Hello i am having trouble with passing a php return value to the innerHTML
hello i get some help here yesterday for a problem i was having tablesorter.
I'm having problems when trying to compile the following code: I first tried compiling
I'm having problems with an insert to the database. First an explanation of my
hello im just having a problem here with PREG_MATCH_ALL() lets say i have 2
I am having some problems with processing my form in python django when using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.