Jump to content

dartfrogs

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

dartfrogs's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I solved my own problem!!! Yippee I added the variable into the link for the next and prev paging link. $navPagedisplay .='<table class="tbl" align="center" width="50%"><tr><td align="left" width="20%"><tr><td>'; if($page_f<>0) { $navPagedisplay .='<a href="testing.php?cid='.$cid.'&start='.$page_back.'&page_f='.$page_back.'"><font face="Verdana" size="2">PREV '.$page_name.'</font></a>'; } $navPagedisplay .='</td><td align="left" width="10%">'; //// if our variable $back is equal to 0 or more then only we will display the link to move back //////// if($back >=0 and ($back >=$page_f)) { $navPagedisplay .='<a href="testing.php?cid='.$cid.'='.$back.'&page_f='.$page_f.'"><font face="Verdana" size="2">PREV</font></a>'; } //////////////// Let us display the page links at center. We will not display the current page as a link /////////// $navPagedisplay .='</td><td align="center" width="30%">'; for($i=$page_f;$i < $nume and $i<($page_f+$page_limit);$i=$i+$limit) { if($i <> $eu) { $i2=$i+$page_f; $navPagedisplay .=' <a href="testing.php?cid='.$cid.'&start='.$i.'&page_f='.$page_f.'"><font face="Verdana" size="2">'.$i.'</font></a> '; } else { $navPagedisplay .=''.$i.''; } /// Current page is not displayed as link and given font color red } $navPagedisplay .='</td><td align="right" width="10%">'; ///////////// If we are not in the last page then Next link will be displayed. Here we check that ///// if($this1 < $nume and $this1 <($page_f+$page_limit)) { $navPagedisplay .='<a href="testing.php?cid='.$cid.'&start='.$next.'&page_f='.$page_f.'"><font face="Verdana" size="2">NEXT</font></a>'; } $navPagedisplay .='</td><td align="right" width="20%">'; if($p_fwd < $nume) { $navPagedisplay .='<a href="testing.php?cid='.$cid.'&start='.$page_fwd.'&page_f='.$page_fwd.'"><font face="Verdana" size="2">NEXT '.$page_limit.'</font></a>'; } $navPagedisplay .='</td></tr></table>'; paintitemspage($content, $title, $footercontent, $navPagedisplay); }
  2. No problem Your are right I do have a $_GET instead of a $_POST I forgot I had to change it to $_GET because the value comes from a link. $eu = ($start -0); $limit = 10; // No of records to be shown per page. $this1 = $eu + $limit; $back = $eu - $limit; $next = $eu + $limit; $start=$_GET['start']; $page_name="testing.php"; // If you use this code with a different page ( or file ) name then change this // To take care global variable if OFF if(!($start > 0)) { // This variable is set to zero for the first page $start = 0; } if((!isset($_GET['cid'])) && (!isset($_GET['p_f']))) { mainPage(); } else { $_SESSION['cidNumber'] = $_GET['cid']; // store session data my attempt at sessions $cid = $_SESSION['cidNumber']; Countryselectitems(); } function Getflags() { $res = sql_select_country(); $flags = '<form action="testing.php" name="form" method="post"><table>'; while($resultset = @mysql_fetch_array($res)) { $id = $resultset['id']; $country = $resultset['country_name']; $flag = $resultset['flag_image']; $flags .=' <tr> <td>'. $country .'</td> <td><a href="testing.php?cid='.$id.'"><img src="'. $flag .'" name="flag"" border="0"></a></td> ///value comes from clicking on image which passed $cid <td></td> </tr> '; //$i += 1; } $flags .=' </table></form>'; mysql_free_result($res); return $flags; } the above code is what mainly gets the value from an image link. The code below is what I use to page through the results and when I hit the next I lose the value $p_limit=10; // This should be more than $limit and set to a value for which links to be breaked $p_f=$_GET['p_f']; // To take care global variable if OFF if(!($p_f > 0)) { // This variable is set to zero for the first page $p_f = 0; } $p_fwd=$p_f+$p_limit; $p_back = $p_f-$p_limit; //////////// End of variables for advance paging /////////////// /////////////// Start the buttom links with Prev and next link with page numbers ///////////////// $navPagedisplay .='<table class="tbl" align="center" width="50%"><tr><td align="left" width="20%"><tr><td>'; if($p_f<>0) { $navPagedisplay .='<a href="testing.php?'.$cid.'&start='.$p_back.'&p_f='.$p_back.'"><font face="Verdana" size="2">PREV '.$p_limit.'</font></a>'; } $navPagedisplay .='</td><td align="left" width="10%">'; //// if our variable $back is equal to 0 or more then only we will display the link to move back //////// if($back >=0 and ($back >=$p_f)) { $navPagedisplay .='<a href="testing.php?start='.$back&p_f.'='.$p_f.'"><font face="Verdana" size="2">PREV</font></a>'; } //////////////// Let us display the page links at center. We will not display the current page as a link /////////// $navPagedisplay .='</td><td align="center" width="30%">'; for($i=$p_f;$i < $nume and $i<($p_f+$p_limit);$i=$i+$limit) { if($i <> $eu) { $i2=$i+$p_f; $navPagedisplay .=' <a href="testing.php?start='.$i.'&p_f='.$p_f.'"><font face="Verdana" size="2">'.$i.'</font></a> '; } else { $navPagedisplay .=''.$i.''; } /// Current page is not displayed as link and given font color red } $navPagedisplay .='</td><td align="right" width="10%">'; ///////////// If we are not in the last page then Next link will be displayed. Here we check that ///// if($this1 < $nume and $this1 <($p_f+$p_limit)) { $navPagedisplay .='<a href="testing.php?start='.$next.'&p_f='.$p_f.'&cid='.$cid.'"><font face="Verdana" size="2">NEXT</font></a>'; } $navPagedisplay .='</td><td align="right" width="20%">'; if($p_fwd < $nume) { $navPagedisplay .='<a href="testing.php?start='.$p_fwd.'&p_f='.$p_fwd.'&cid='.$cid.'"><font face="Verdana" size="2">NEXT '.$p_limit.'</font></a>'; } $navPagedisplay .='</td></tr></table>'; paintitemspage($content, $title, $footercontent, $navPagedisplay);
  3. I have managed to get this far now banging head on desk.. I need the $_POST value to pass through when paging through results from mysql. I have the code all in one script page and when the value is hard coded it works great without a hitch.. Here is what I have. I have tried to set up $_SESSIONS just not sure if I am doing it right or calling it right. <?php session_start(); include ("battlegear.php"); include("lib/io.lib.php"); $conn = connect(); $eu = ($start -0); $limit = 10; // No of records to be shown per page. $this1 = $eu + $limit; $back = $eu - $limit; $next = $eu + $limit; $start=$_GET['start']; $page_name="testing.php"; // If you use this code with a different page ( or file ) name then change this // To take care global variable if OFF if(!($start > 0)) { // This variable is set to zero for the first page $start = 0; } if((!isset($_GET['cid'])) && (!isset($_GET['p_f']))) { mainPage(); } else { $_SESSION['cidNumber'] = $_GET['cid']; // store session data $cid = $_SESSION['cidNumber']; Countryselectitems(); } function mainPage() { $flags = Getflags(); $category = Getcategories(); $newitem = GetNewItems(); global $_GET; // stuff strings into template and return html string echo use_template("templates/page.html", array("#content#","#title#", "#flags#", "#footercontent#", "#category#", "#newitem#"), array($content, $title, $flags, $footercontent, $category, $newitem)); } function Getflags() { $res = sql_select_country(); $flags = '<form action="testing.php" name="form" method="post"><table>'; while($resultset = @mysql_fetch_array($res)) { $id = $resultset['id']; $country = $resultset['country_name']; $flag = $resultset['flag_image']; $flags .=' <tr> <td>'. $country .'</td> <td><a href="testing.php?cid='.$id.'"><img src="'. $flag .'" name="flag"" border="0"></a></td> <td></td> </tr> '; //$i += 1; } $flags .=' </table></form>'; mysql_free_result($res); return $flags; } } Function Countryselectitems () { global $_GET; global $_SESSION; global $cid; global $eu; global $limit; global $this1; global $back; global $next; global $start; global $page_name; if($cid) { $res = sql_select_country_id(); $content .='<table class="tbl" width="100%" align="left" cellpadding="2" cellspacing="3" ><tr>'; if($total = mysql_num_rows($res) == 0) { mysql_free_result($res); $content .='<tr><td>There are no items matching your search at this time.</td></tr>'; } while($countryflag = mysql_fetch_array($res)) { $id = $countryflag['id']; $content .='<td colspan="10" align="center">'.$countryflag['country_name'].'<br><img src="'. $countryflag['flag_image'] .'" width="50" height="50"/></td><tr><td align="center">'; /////////////// WE have to find out the number of records in our table. We will use this to break the pages/////// $query2=" SELECT * FROM inventory where country_id=$id "; $result2=mysql_query($query2); echo mysql_error(); $nume=mysql_num_rows($result2); /////// The variable nume above will store the total number of records in the table//// /////////// Now let us print the table headers //////////////// $bgcolor="#f1f1f1"; $content .='<table class="tbl" width="100%" align="left" cellpadding="2" cellspacing="3"><tr> <td class="hr"> Image</td> <td class="hr"> Product Name</td> <td class="hr"> Price</td> <td class="hr" > Catalog ID</td> <td colspan="2" class="hr"> In Stock</td></tr>'; ////////////// Now let us start executing the query with variables $eu and $limit set at the top of the page/////////// $query=" SELECT * FROM inventory where country_id=$id limit $eu, $limit "; $result=mysql_query($query); echo mysql_error(); //////////////// Now we will display the returned records in side the rows of the table///////// while($noticia = mysql_fetch_array($result)) { if($bgcolor=="#f1f1f1") { $bgcolor="#ffffff"; } else { $bgcolor="#f1f1f1"; } $in_stock = $noticia['in_stock']; if($in_stock == "N") { $outofstock ="Item not in stock"; } if($in_stock == "Y") { $outofstock =""; } $content .='<tr> <td align="left" class="'.$bgcolor.'" id="title"> <img src="'.$noticia['image'].'" width="50" height="50"/></td> <td align="left" class="'.$bgcolor.'" id="title"> '.$noticia['product_name'].'</td> <td align="left" class="'.$bgcolor.'" id="title"> $'.$noticia['price'].'</td> <td align="left" class="'.$bgcolor.'" id="title"> '.$noticia['catalog_id'].'</td> <td align="left" class="'.$bgcolor.'" id="title"> '.$noticia['in_stock'].' '.$outofstock.'</font></td> <td align="left" class="'.$bgcolor.'" id="title"> </td> </tr>'; } $content .='</table>';////////////////////////////// End of displaying the table with records //////////////////////// } } ///// Variables set for advance paging/////////// $p_limit=10; // This should be more than $limit and set to a value for which links to be breaked $p_f=$_GET['p_f']; // To take care global variable if OFF if(!($p_f > 0)) { // This variable is set to zero for the first page $p_f = 0; } $p_fwd=$p_f+$p_limit; $p_back = $p_f-$p_limit; //////////// End of variables for advance paging /////////////// [color=red]/////////////// Start the buttom links with Prev and next link with page numbers /////////////////[/color] $navPagedisplay .='<table class="tbl" align="center" width="50%"><tr><td align="left" width="20%"><tr><td>'; if($p_f<>0) { $navPagedisplay .='<a href="testing.php?'.$cid.'&start='.$p_back.'&p_f='.$p_back.'"><font face="Verdana" size="2">PREV '.$p_limit.'</font></a>'; } $navPagedisplay .='</td><td align="left" width="10%">'; //// if our variable $back is equal to 0 or more then only we will display the link to move back //////// if($back >=0 and ($back >=$p_f)) { $navPagedisplay .='<a href="testing.php?start='.$back&p_f.'='.$p_f.'"><font face="Verdana" size="2">PREV</font></a>'; } [color=red]//////////////// display the page links at center. will not display the current page as a link ///////////[/color] $navPagedisplay .='</td><td align="center" width="30%">'; for($i=$p_f;$i < $nume and $i<($p_f+$p_limit);$i=$i+$limit) { if($i <> $eu) { $i2=$i+$p_f; $navPagedisplay .=' <a href="testing.php?start='.$i.'&p_f='.$p_f.'"><font face="Verdana" size="2">'.$i.'</font></a> '; } else { $navPagedisplay .=''.$i.''; } /// Current page is not displayed as link and given font color red } $navPagedisplay .='</td><td align="right" width="10%">'; [color=red]///////////// If we are not in the last page then Next link will be displayed. Here we check that /////[/color] if($this1 < $nume and $this1 <($p_f+$p_limit)) { $navPagedisplay .='<a href="testing.php?start='.$next.'&p_f='.$p_f.'&cid='.$cid.'"><font face="Verdana" size="2">NEXT</font></a>'; } $navPagedisplay .='</td><td align="right" width="20%">'; if($p_fwd < $nume) { $navPagedisplay .='<a href="testing.php?start='.$p_fwd.'&p_f='.$p_fwd.'&cid='.$cid.'"><font face="Verdana" size="2">NEXT '.$p_limit.'</font></a>'; [color=red]///tried to add the value here but not working right.[/color] } $navPagedisplay .='</td></tr></table>'; paintitemspage($content, $title, $footercontent, $navPagedisplay); } function paintitemspage($content, $title, $footercontent, $navPagedisplay) //Display stuff { // stuff strings into template and return html string echo use_template("templates/displaypage.html", array("#content#","#title#", "#footercontent#", "#navPagedisplay#"), array($content, $title, $footercontent, $navPagedisplay)); } function sql_select_country_id() ///works great gets what I need from database { global $conn; global $cid; $sql = "SELECT id, country_name, flag_image from country where id=$cid"; //$sql .= '"SELECT `country_id`, `product_name`, `in_stock`, `image`, `price`, `catalog_id` FROM `inventory` where country_id=country.id"'; $res = mysql_query($sql, $conn) or die(mysql_error()); return $res; } function sql_select_country() //works great gets the right info { global $conn; $sql = "SELECT `id`, `country_name`, `flag_image` FROM `country`"; $res = mysql_query($sql, $conn) or die(mysql_error()); return $res; } ?> I would like any help I can get I am still working on this but if you have a sugestion please send it my way.
  4. Hey thank you I got it figured out and got things working. What I had to do was go this route: function Getflags() { $res = sql_select_country(); $cid = $_GET['cid']; $flags = '<form action="display.php" name="form" method="post"><table>'; while($resultset = @mysql_fetch_array($res)) { $id = $resultset['id']; $country = $resultset['country_name']; $flag = $resultset['flag_image']; $flags .=' <tr> <td>'. $country .'</td> <td><a href="display.php?cid='.$id.'"><img src="'. $flag .'" name="flag"" border="0"></a></td> <td></td> </tr> '; //$i += 1; } $flags .=' </table></form>'; mysql_free_result($res); return $flags; } The right value is passed through and so far it works in both IE and FF. Thanks for the help.
  5. How do I make the image a link? And have it pass a value at the same time?
  6. Added a form name and the onclick still no work... Bummer...
  7. Okay I have searched and searched for a good alternative to the problem with IE using images as a submit button. (took me a while to find out this was an iusse) What I have and works great in FF is: function Getflags() { $res = sql_select_country(); $cid = $_POST['flag']; $flags = '<form action="display.php" method="post"><table>'; while($resultset = @mysql_fetch_array($res)) { $id = $resultset['id']; $country = $resultset['country_name']; $flag = $resultset['flag_image']; $flags .=' <tr> <td>'. $country .'</td> //submit button returns $id fine with $_POST in FF not IE!!! <td><input type="image" src="'. $flag .'" name="flag" value="'.$id.'" /></td><td></td> </tr> '; //$i += 1; } $flags .=' </table></form>'; mysql_free_result($res); return $flags; } So my question is without using hidden fields, or image coords. what is a good alternative solution? ??? Help
  8. I figured out the problem... Yippee! function Getflags() { $res = sql_select_country(); $cid = $_POST['flag']; $flags = '<form action="display.php" method="post"><table>'; while($resultset = @mysql_fetch_array($res)) { $id = $resultset['id']; $country=$resultset['country_name']; $flag=$resultset['flag_image']; $flags .=' <tr> <td>'. $country .'</td> <td><input type="image" src="'. $flag .'" name="flag" value="'.$id.'" onclick="javascript:this.form.submit()"/></td> <td></td> </tr> '; //$i += 1; } $flags .=' </table></form>'; mysql_free_result($res); return $flags; } You can see where I made the changes and it works...
  9. this did not help because I am getting a value just getting the wrong value. I need to gett eh value for the record not the value for the last record every single time. I thank you for the sugestion I did change the other end to $_GET.
  10. I am retrieving data from a mysql table and I am using the image with an onclik attribute to submit the information from the records retrieved. When I echo the post value of the record click it always comes back as the value of the last record retrieved from the table. here is the code. <?php session_start(); include ("battlegear.php"); include("lib/io.lib.php"); $title .= ' <table width="100%"><tr><td align="center"><font color="red">Welcome To</font></td></tr></table>'; $footercontent .= '<table class="bd" width="100%"><tr><td class="hr">Battlegear Toys</td></tr></table>'; $conn = connect(); $flags = Getflags(); $category = Getcategories(); $newitem = GetNewItems(); ///this is the value I need passed to the other page... echo $cid = $_POST['xcid']; This is the function I am using to get the records from mysql and I am using an image with the onclick to submit the info. to test to see if I get the right value to pass I have echoed the value back to the same page but it keeps coming up with the value of the last record. I am not sure where I am going wrong or if this is even the right way to try this. function Getflags() { $res = sql_select_country(); $flags = '<form action="index.php" method="post"><table>'; while($resultset = @mysql_fetch_array($res)) { $id = $resultset['id']; $country=$resultset['country_name']; $flag=$resultset['flag_image']; $flags .=' <tr> <td><input type="hidden" name="xcid" value="'.$id.'" />'. $country .'</td> <td><input type="image" src="'. $flag .'" onclick="javascript:this.form.submit()"/></td> <td></td> </tr> '; $i += 1; } $flags .=' </table></form>'; mysql_free_result($res); return $flags; } function sql_select_country() { global $conn; $sql = "SELECT `id`, `country_name`, `flag_image` FROM `country`"; $res = mysql_query($sql, $conn) or die(mysql_error()); return $res; } function connect() { $conn = mysql_connect("localhost", "root", "raccoon+eyes"); mysql_select_db("battlegear_inventory"); return $conn; } // stuff strings into template and return html string echo use_template("templates/page.html", array("#content#","#title#", "#flags#", "#footercontent#", "#category#", "#newitem#"), array($content, $title, $flags, $footercontent, $category, $newitem)); ?> I have placed the code on the internet the link is http://www.magnetic-webdesign.com/newsite/index.php When you click on a country flag image it is suppose to pass the id value through to the next page but as you can see it only passes the last id value of the last record. I hope this is making sense to you all. Any help I can get to fix this would be great.
  11. You hit the nail on the head!!! It is working! I did not see that I never called the info into the form! No wonder there was no post vaule. I added this bit of code into the form and did a couple of tweeks to the function and I am getting data and inserting it into mysql! yes! Thank you for spotting that! <tr> <td> Category List: <select name="category_lists"> <option value='.$category_lists.'</option> </select> </td> </tr> <tr> <td> Country: <select name="countrylist"> <option value='.$countrylist.'</option> </select> </td>
  12. Okay I made a couple of changes yet I am still not getting the value to pass through. At a complete loss here. I have posted all of the code I have to see if maybe someone can see where I am missing the passing of the value for catagory_lists. <?php include("lib/common.lib.php"); $pagetitle = "Battlegear Toys"; $uploadDir = "../upload/"; if (isset($_POST['submit'])) { Input(); echo BuildInputForm(); exit; } echo BuildInputForm(); exit; //functions function Getflags() { $flags = '<table>'; $r = connectbg(); $sql="SELECT country_name, flag_image FROM country"; $res=mysql_query($sql, $r); while ($resultset = @mysql_fetch_array($res)) { // $flags .= ($mt['flag_image']); $flags .= '<tr> <td>' . $resultset['country_name'] . '</td> <td ><img src="' .$resultset['flag_image'].'" /></td> </tr>'; $i += 1; } $flags .= '</table>'; disconnectbg($r); return $flags; } //works for showing info function BuildCategory() { $category_lists = ' <select name="category_lists">'; // $category_lists .= ('category_lists'); $q = "SELECT id, category FROM category"; $l = connectbg(); $rs = @mysql_query($q, $l); while ($mt = @mysql_fetch_array($rs)) { // $content .= '<option value="'.$mt[id].'">'.$mt['name'].' - '.$mt['description'].'</option>'; $category_lists.= '<option value="'.$mt[id].'">'.$mt['category'].'</option>'; } disconnectbg($l); return $category_lists. ' </select>'; } //works but no value posted either. Figured I would fix the first and then duplicate it to make this one work. function BuildCountry() { $countrylist = ' <select name="countrylist"> '; $ountrylist .= BuildOption('', 'countrylist'); $r = connectbg(); $sql="SELECT id, country_name FROM country"; $res=mysql_query($sql, $r); while ($mt = @mysql_fetch_array($res)) { $countrylist .= BuildOption($mt['country_name'], 'countrylist', $mt['id']); } disconnectbg($r); return $countrylist . ' </select>'; } function BuildInputForm() { $flags = Getflags(); if (isset($_POST['reset'])) { // user clicked the clear button, so blow off all the search criteria // and redraw the search page $_REQUEST['product_name'] = null; $_POST['catalog_id'] = null; $_POST['price']= null; $_POST['description'] = null; $_POST['keywords'] = null; $_POST['catagory_list'] = null; $_POST['countrylist'] = null; } $category_lists ='Category List' .BuildCategory(); $countrylist = 'Country' . BuildCountry(); $content .= '<form name="form" method="post" ENCTYPE="multipart/form-data" action="input.php"> <table> <tr> <td>Product Name: <input type="text" name="product_name"></td> </tr> <tr> <td>Catalog ID: <input type="text" name="catalog_id" ></td> </tr> <tr> <td>Price: $<input type="text" name="price" ></td> </tr> <tr> <td>Description: <input type="text" name="description" ></td> </tr> <tr> <td>In Stock: <input type="text" name="in_stock" ></td> </tr> <tr> <td>Keyword: <input type="text" name="keywords" ></td> </tr> <tr> <td > <input type="hidden" name="MAX_FILE_SIZE" value="2000000"> Upload image: <input type="file" name="userfile" id="userfile"> </td> </tr> <tr> <td> <input name="submit" value="submit" type="submit"> </td> <td> <input name="reset" value="reset" type="submit"> </td> </tr> </table> </form>'; return use_template("templates/page.html", array("#pagetitle#", "#content#", "#category_lists#", "#countrylist#" , "#flags#"), array($pagetitle, $content, $category_lists, $countrylist, $flags) ); } function Input() { $product_name=$_POST['product_name']; $catalog=$_POST['catalog_id']; $price=$_POST['price']; $description=$_POST['description']; $keywords=$_POST['keywords']; $imageName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $imageSize = $_FILES['userfile']['size']; $imageType = $_FILES['userfile']['filetype']; $filePath = $uploadDir . $imageName; $country = $_GET['countrylist']; $category_lists = $_POST['category_lists']; echo "<pre>"; print_r($_POST); echo "</pre>"; //$category = ; $result = move_uploaded_file($tmpName, $filePath); if (!$result) { echo "Error uploading file"; exit; } if(!get_magic_quotes_gpc()) { $imageName = addslashes($imageName); $filePath = addslashes($filePath); } $r = connectbg(); $sql="insert into inventory (category_id, country_id, product_name, catalog_id, price, description, keywords, image) values ('$category_lists','$country','$product_name', '$catalog', '$price', '$description','$keywords','$filePath')"; $res=mysql_query($sql, $r) or die (mysql_error()); disconnectbg(); } ?>
  13. I have looked on the posts and I see several post about this subject but none that have really helped. My problem is inserting the value from my dynamitc drop down. The dropdown menu works great. (See function below) But the post value is null. //category_lists function retrieves data from mysql function BuildCategory() { $category_lists = ' <select name="category_lists">'; $category_lists .= ('category_lists'); $q = "SELECT id, category FROM category"; $l = connectbg(); $rs = @mysql_query($q, $l); while ($mt = @mysql_fetch_array($rs)) { $category_lists.= "<option value=$mt[id]>$mt[category]</option>"; } disconnectbg($l); return $category_lists. ' </select>'; } When the person hits the submit button all of the other input boxes work great and things are entered into the database. This is the only one that will not work. //insert code function BuildInputForm() { //code before not shown...... //calls to functions to create page $category_lists ='Category List' .BuildCategory(); $countrylist = 'Country' . BuildCountry(); //code after not shown... } //insert function function Input() { $product_name=$_POST['product_name']; $catalog=$_POST['catalog_id']; $price=$_POST['price']; $description=$_POST['description']; $keywords=$_POST['keywords']; $imageName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $imageSize = $_FILES['userfile']['size']; $imageType = $_FILES['userfile']['filetype']; $filePath = $uploadDir . $imageName; $country = $_POST['countrylist']; $category_lists = $_POST['category_lists']; $result = move_uploaded_file($tmpName, $filePath); if (!$result) { echo "Error uploading file"; exit; } if(!get_magic_quotes_gpc()) { $imageName = addslashes($imageName); $filePath = addslashes($filePath); } $r = connectbg(); $sql="insert into inventory (category_id, country_id, product_name, catalog_id, price, description, keywords, image) values ('$category_lists','$country','$product_name', '$catalog', '$price', '$description','$keywords','$filePath')"; $res=mysql_query($sql, $r) or die (mysql_error()); disconnectbg(); } If anyone can see why I can't get the value of the category_lists drop down menu please let me know. Thank you!
×
×
  • 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.