Jump to content

anandi

New Members
  • Posts

    6
  • Joined

  • Last visited

anandi's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you. I have noted this and will be more mindful going ahead.
  2. Indeed it is a very old code from a very old file but we need to run it to get the data. Short of rewriting all those php scripts I don't know what else to do. I've looked at it so often I simply can not see why $group2 is not getting passed. Thank you.
  3. It is there - its in the form that works perfectly so for sake of brevity I didn't copy all of the code here. My issue is with the second submit that doesn't pick up the $group2 variable. Thank you.
  4. I changed to <?php echo $userid ?> . That's one issue solved. Thank you.
  5. <? header("Cache-Control: public"); include ("header.php"); //db info for DB2 include ("logl.php"); if ($_POST['submit']) { $type = $_POST["type"]; $cgid = $_POST["cgid"]; $comp = $_POST["comp"]; // echo $cgid; value gets passed // echo $comp; value gets passed // echo $type; value gets passed if ($type == "UG") { if(isset($_POST) && !empty($_POST["group2"])) { // this value does NOT get passed $group2 = $_POST["group2"]; $cgid = $_POST["cgid"]; $sqla = "UPDATE `Cgroup` SET `Group ` = '$group2' WHERE CGID = '$cgid' "; $resulta = mysqli_query($link1, $sqla); // this sql doesnt run. The value of $group2 doesn't get passed into the sql; } else { ?> <form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" > $sqla = "SELECT * FROM `Cgroup` WHERE CGID = $cgid "; $resulta = mysqli_query($link1,$sqla); $myrowa=mysqli_fetch_array($resulta); ?> <table border="1" cellspacing="1" style="border-collapse: collapse" bordercolor="#000066" width="95%" cellpadding="5" > <tr><td colspan="3" bgcolor="#B5CBEF" height="16" width="100%" bordercolor="#FFFFFF" ><font size="1" face="Calibri"><b><font face="Calibri" size="2" color="#000066">&nbsp;</font></b></td></tr><tr><td colspan="4" bgcolor="#D6DFEF" height="16" width="100%" bordercolor="#FFFFFF"><tr><td height="30" width="55" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> <font face="Calibri" size="2" color="#004080" >Old Group : <input type=text name='group1' size=50 value="<? echo $myrowa["Group"] ?>"></td></tr> <tr><td height="30" width="55" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> <font face="Calibri" size="2" color="#004080" >New Group : <input type=text name='group2' size=50> </td></tr> <tr><td height="30" width="55" bgcolor="#EFF3F7" bordercolor="#FFFFFF"> <input name='submit' type='submit' value='Rename'> <input type="hidden" name="cgid" value="<? echo $cgid ?>" > </td></tr><tr><td colspan="3" bgcolor="#B5CBEF" height="25" width="737" ><p align="center"><font face="Calibri" size="2"></td></tr> </table> </form> <? } } ?> <html> <head> </head> <body> <div class=Section1> <input type="hidden" name="userid" value="<? echo $userid ?>"> <input type="hidden" name="sid" value="<? echo $sid ?>"> <?php } else { ?> <form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" > // The first form - this works perfectly <input type="submit" name = "submit" value="Select"></span></b></p> <input type="hidden" name="userid" value="<? echo $userid ?>" > </form> <?php } ?> I have the above old file. I am able to get the first php self working but the one inside it is not working. The form processes but the value doesn't get passed on submit . Where am i going wrong ? Thanks in advance A
  6. Hi I have some data that i display on screen and i need to be able to export to excel as is. Whatever i have found online only refers to data in a single table but my sql statement is of joins. I am searching for a simple way to do this using this code below. Would very much appreciate some help. thanks. anandis $OR = " SELECT * FROM address a LEFT JOIN Cities USING(CITYID) JOIN Customers c USING(CID) WHERE a.SID = '$sid' ORDER BY c.`Company` asc, `CITYID` asc "; $resultOR = mysqli_query($link2, $OR) or die(mysqli_errorno()); $numofrows = mysqli_num_rows($resultOR); echo "<table border='1' style='border-collapse: collapse' bordercolor='#111111' width='100%'>\n"; echo "<tr bgcolor='#FFEAED'> <td><b><font size=3 face=Calibri color=brown>S.No</b></td> <td><b><font size=3 face=Calibri color=brown>CAID</b></td> <td><b><font size=3 face=Calibri color=brown>CID</b></td> <td><b><font size=3 face=Calibri color=brown>Company</b></td> <td><b><font size=3 face=Calibri color=brown>Street</b></td> ETC \n"; for ($p = 1; $p <= $numofrows; $p++) { $myrow = mysqli_fetch_array($resultOR); $caid = $myrow["CAID"]; $cid = $myrow["CID"]; $cityid= $myrow['CITYID']; $result2 = mysqli_query($link2, "SELECT * FROM Cities WHERE `CITYID` = '$cityid' "); $myrow2 = mysqli_fetch_array($result2); $city = $myrow2["City"]; $sql22 = "SELECT * FROM Customers WHERE `CID` = '$cid' "; $result22 = mysqli_query($link2, $sql22) or die (mysqli_errorno ()); $myrow22=mysqli_fetch_array($result22); $company = $myrow22["Company"]; if ($p % 2) { //this means if there is a remainder echo "<TR bgcolor=\"#FAF0F0\">\n"; } else { //if there isn't a remainder we will do the else echo "<TR bgcolor=\"white\">\n"; } echo " <td><font face=\"Calibri\" size=\"3\" color=\"brown\">$p </TD> <td><font face=\"Calibri\" size=\"3\" color=\"brown\">$city </TD> <td><font face=\"Calibri\" size=\"3\" color=\"brown\">$cid </TD> <td><font face=\"Calibri\" size=\"3\" color=\"brown\">$company</TD> <td><font face=\"Calibri\" size=\"3\" color=\"brown\">" . $myrow["Street"] . " </TD> echo "</TR>\n"; } echo "</TABLE>\n";
×
×
  • 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.