Hvorfor ingen post data ?
Er ved at lave en hjemmeside hvor jeg har en form med et par tekst felter og et par dropdown menuer lavet ud fra min DB.Problemet er at når jeg trykker submit kommer jeg fint ned i min else sætning, dvs der bliver sendt data fra submit knappen, men resten af mine data fra formen kommer ikke med.
Nogen der kan sige min hvad der er galt ?
<html>
<head>
<title>Gridstatus - add new issue</title>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#000000" vlink="#000000" alink="#000000">
<H1>Welcome to Gridstatus add new issue</H1><br>
<?php
require("config.php"); // getting MySQL variables
@mysql_connect("$mysql_host", "$mysql_user", "$mysql_pw") or die("Connection db couldnt be made");
@mysql_select_db("$mysql_db") or die("Database could not be found");
echo "Category is holding: "; echo $_Post["category"]; echo "<br>";//test
$submitCat=$_Post["category"];
$submitTitle=$_Post["title"];
$submitSite=$_Post["site"];
$submitPriority=$_Post["priority"];
$submitText=$_Post["text"];
if (!isset($_POST['submit'])) // if page is not submitted to itself - echo the form
{
echo "<form action=\"$PHP_SELF\" method=\"post\" >"; //starts the form and when user click submit reloads the page with the info entered in the form
echo "
Select category: ";
$catsdb = mysql_query("select * from category") or die(mysql_error()) ; //gets all categories in the DB
echo "<select name=\"category\">"; //creates a dropdown menu with all categories in the DB
while($view = mysql_fetch_array($catsdb)) //fetches all rows from the returned data
{
echo "<option value=\""; echo $view[cat_id]; echo "\">"; echo $view[cat_name]; echo "</option>"; //writes out the different categories
}
echo "</select><br><br>";//ends dropdown box
echo "
Title: <input type=\"text\" size=\"20\" maxlength=\"20\" name=\"title\">";//creates text field to enter the title of the new issue
echo "
<br><br>Site: <select name=\"site\">";
$site=mysql_query("select * from sites") or die(mysql_error()) ; //gets all site in the DB - should be a check if user has access to open new issue for the sites
while($view = mysql_fetch_array($site)) //fetches all rows from the returned data
{
echo "<option value=\""; echo $view[site_id]; echo "\">"; echo $view[site_name]; echo "</option>"; //writes out the different sites
}
echo "</select><br><br>";//ends dropdown box
echo "
Priority: <select name=\"priority\">";
$priority=mysql_query("select * from priority") or die(mysql_error()) ; //gets all priority from DB
while($view = mysql_fetch_array($priority)) //fetches all rows from the returned data
{
echo "<option value=\""; echo $view[priority_id]; echo "\">"; echo $view[priority]; echo "</option>"; //writes out the different priority
}
echo "</select><br><br>";//ends dropdown box
echo "
<textarea rows\"5\" cols=\"100\" name=\"text\" wrap=\"physical\">Enter the text for the new issue</textarea>";//creates text field to enter the text of the new issue
echo "
<br><input type=\"submit\" value=\"submit\" name=\"submit\"></form>";
}
else //if page submitted to itself enter the data into the DB
{
echo "Else <br>";
echo $submitCat;
}
mysql_close();
?>
</body></html>
