-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
When you say "after submit." do you mean the user ends on that page or the script processes the data on that page, if its just where the user ends up then have your form post to a "processing page" and then have a condition to redirect you (revised code from fortnox007) // the if-clause if(isset($_POST['submit'])){ $zip = $_POST['zipcode']; if ($zip!=''&& $zip >= 91900 && $zip <= 92600){ header( 'Location: http://www.yoursite.com/zip_page.html' ) ; // the header will automatically redirect }else{ header( 'Location: http://www.yoursite.com/nonzip_page.html' ) } }
-
checkboxes in form are not inserting to mysql
MadTechie replied to turpentyne's topic in PHP Coding Help
LOL so did i on the first run (and i was editing it at the time) D'oh! -
checkboxes in form are not inserting to mysql
MadTechie replied to turpentyne's topic in PHP Coding Help
@dgoosens, yes they we're corrected in my last post -
Erm.. what was you expecting ? If you don't want the message just comment it out //initilize variables $var_nic = ''; $var_full_name = ''; $var_name_with_initials = ''; $var_address = ''; $var_contact_number = ''; $var_gender = ''; if(isset($_POST['customer_id'])) { $customer_id=$_POST['customer_id']; $query = "select * from customer where customer_id=" .$customer_id; $result = mysql_query($query) or die(mysql_error()); if(mysql_num_rows($result) < 1) { //echo 'The record could not be found.'; <-- remove this line while ($row=mysql_fetch_array($result)) { while ($row=mysql_fetch_array($result)) { // replace blank variables with variables from the database $var_nic = $row['nic']; $var_full_name = $row['full_name']; $var_name_with_initials = $row['name_with_initials']; $var_address = $row['address']; $var_contact_number = $row['contact_number']; $var_gender = $row['gender']; } } } }
-
The more time you spend coding the more concepts you become exposed to for example here sasa came up with a great concept of converting the time to a number of the week, but then needed it to start from Monday, Breaking his code down may make it easier to understand <?php $staff = array('Tara', 'Tom', 'Branda'); // time() starts from Thursday (jan 1st 1971) so add 3 days $start_of_week = time()+(3*24*60*60) + (7*24*60*60); //Breaks date into weeks (days of 7) $week_into_days = $start_of_week/(7*24*60*60); /* Now we divide $week_into_days by 3 and get the remainder, So, day 1=1, 2=2, 3=3, 4=1, 5=2 */ echo $staff[$week_into_days % count($staff)]; //day Mod 3,
-
checkboxes in form are not inserting to mysql
MadTechie replied to turpentyne's topic in PHP Coding Help
Sorry i just noticed a type in the html, however plant_id isn't in the form !! and a header is after output! here is a full update <html> <title>submit a new plant </title> <link rel="stylesheet" type="text/css" href="styles.css"> <body> <?php if (isset($_POST['submitted'])) { $errors = array(); $descriptor1 = trim($_POST['plant_id']); if (empty($_POST['about_this_plant'])) { $errors[] = 'your plant id did not continue to the new page'; } else { $descriptor2 = trim($_POST['about_this_plant']); } $descriptor60 = isset($_POST['green_leaf']); $descriptor61 = isset($_POST['white_leaf']); $descriptor62 = isset($_POST['cream_leaf']); $descriptor63 = isset($_POST['pink_leaf']); $descriptor64 = isset($_POST['red_leaf']); $descriptor65 = isset($_POST['orange_leaf']); $descriptor66 = isset($_POST['yellow_leaf']); $descriptor67 = isset($_POST['blue_leaf']); $descriptor68 = isset($_POST['purple_leaf']); $descriptor69 = isset($_POST['purpleblack_leaf']); if (empty($errors)) { require ('databaseConnectFile.php'); $query = "INSERT INTO table (green_leaf, white_leaf, cream_leaf, pink_leaf, red_leaf, orange_leaf, yellow_leaf, blue_leaf, purple_leaf, purpleblack_leaf) VALUES ('$descriptor60', '$descriptor61', '$descriptor62', '$descriptor63', '$descriptor64', '$descriptor65', '$descriptor66', '$descriptor67', '$descriptor68', '$descriptor69')"; $result = @mysql_query ($query); if ($result) { if(isset($_POST['about_this_plant'])) { $plant_id=mysql_insert_id(); } header ("Location: http://www.mywebsite.com/nextpage.php?var1=$plant_id"); echo 'one plant has been added'; exit(); } else { echo 'system error. No plant added'; echo '<p>' . mysql_error() . '<br><br>query:' . $query . '</p>'; exit(); } mysql_close(); } else { echo 'error. the following error occured <br>'; foreach ($errors as $msg) { echo " - $msg<br>\n"; } } // end of if } // end of main submit conditional ?> <form style="border: 1px dotted red; padding: 2px" action="nextpage.php" method="post"><fieldset><legend><b>Describe your plant</b></legend> Leaf color (not including fall season):<br> <input type="checkbox" name="green_leaf" value="" <?php if(isset($_POST['green_leaf'])) echo 'checked="checked"'; ?> > green <input type="checkbox" name="white_leaf" value="" <?php if(isset($_POST['white_leaf'])) echo 'checked="checked"'; ?> > white <input type="checkbox" name="cream_leaf" value="" <?php if(isset($_POST['cream_leaf'])) echo 'checked="checked"'; ?> > cream<br> <input type="checkbox" name="pink_leaf" value="" <?php if(isset($_POST['pink_leaf'])) echo 'checked="checked"'; ?> > pink <input type="checkbox" name="red_leaf" value="" <?php if(isset($_POST['red_leaf'])) echo 'checked="checked"'; ?> > red <input type="checkbox" name="orange_leaf" value="" <?php if(isset($_POST['orange_leaf'])) echo 'checked="checked"'; ?> > orange<br> <input type="checkbox" name="yellow_leaf" value="" <?php if(isset($_POST['yellow_leaf'])) echo 'checked="checked"';?> > yellow <input type="checkbox" name="blue_leaf" value="" <?php if(isset($_POST['blue_leaf'])) echo 'checked="checked"';?> > blue <input type="checkbox" name="purple_leaf" value="" <?php if(isset($_POST['purple_leaf'])) echo 'checked="checked"';?> > purple<br> <input type="checkbox" name="purpleblack_leaf" value="" <?php if(isset($_POST['purpleblack_leaf'])) echo 'checked="checked"';?> > purple-black<br> <input type="hidden" name="submitted" value="TRUE"> <input type="hidden" name="submitted_forward" value='$sn'> <input type="submit" /> </form> </body> </html> -
you shouldn't get Notice: Undefined variable: act as you stated change if (isset($_REQUEST['act'])) { $act = $_REQUEST['act']; } if (isset($_REQUEST['stat'])) { $stat = $_REQUEST['stat']; } to it won't update until you pass act=editdo if (isset($_REQUEST['act'])) { $act = $_REQUEST['act']; }else{ $act = ""; //Default whatever! } if (isset($_REQUEST['stat'])) { $stat = $_REQUEST['stat']; }else{ $stat = 0; }
-
1. cookies are read from the header 2. setting cookie goes into the header (hence before any output) 3. expire is a unix DATE & time (not just seconds) if( $row['password'] == $pass && $row['name'] == $user ) { $username = $row['name']; $uid = $row['id']; setcookie("id", $uid, time()+1400); //creates the first session var setcookie("username", $username, time()+1400); // second session var setcookie("loggedin", "1", time()+1400); //Cookie won't be set visible until a the header loads (next page) echo "<script type=\"text/javascript\">alert(\"".$row['name']."Logged in as ".$username.".\"); window.location=\"index.php?OMG=loggedin\"</script>"; }
-
Just looking at the update, this should update <?php session_start(); error_reporting(E_ALL); ini_set("display_errors", 1); include('../functions.php'); echo dbconnect(); //Echo WTF ??? include ('logincheck.php'); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Fife Flyers - Admin Area</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body leftmargin=0 topmargin=0 marginheight="0" marginwidth="0" bgcolor="#ffffff"> <table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%"> <tr valign="top"> <td width="50%" background="images/bg.gif"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td> <td valign="bottom" background="images/bg_left.gif"><img src="images/bg_left.gif" alt="" width="17" height="16" border="0"></td> <td> <table border="0" cellpadding="0" cellspacing="0" width="780" height="107"> <tr valign="bottom"> <td background="images/fon_top.gif"> </td> <td width="673" background="images/fon_top.gif"> <table border="0" cellpadding="0" cellspacing="0" background=""> <tr valign="bottom"> <td> <!-- but act --> <table border="0" cellpadding="0" cellspacing="0"> <tr valign="bottom"> <td><img src="images/b_left_a.gif" width="9" height="37" alt="" border="0"></td> <td background="images/b_fon_a.gif"><p class="menu01"><a href="index2.php">ADMIN </a></p></td> <td><img src="images/b_right_a.gif" width="9" height="37" alt="" border="0"></td> </tr> </table> <!-- /but act --> </td> </tr> </table> </td> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" width="780" height="107"> <tr valign="top"> <td bgcolor="#E7BD1D"><table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td bgcolor="#E7BD1D"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> </td> </tr> </table></td> </tr> </table> <div align="center"></div> <div align="center"><img src="images/title01.gif" width="183" height="35" alt="" border="0"></div> <nobr class="right"> <div style="padding-top: 10px; padding-left: 20px;"><span class="right"><?php echo("<form action=\"auth.php\" method=\"post\" name=\"login\" id=\"login\"> Username: <input name=\"PHP_AUTH_USER\" type=\"text\" id=\"PHP_AUTH_USER\" value=\"username\"><br><br> Password: <input name=\"PHP_AUTH_PW\" type=\"password\" id=\"PHP_AUTH_PW\" value=\"\"><br> <input type=\"submit\" name=\"Submit\" value=\"Login\"> </form>"); ?></span></div> </nobr> <p class="left"> </p> <br> <br> </td> <td rowspan="2"> <div align="center"><img src="images/top01.gif" width="597" height="24" alt="" border="0"></div> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td> </td> <td> <p style="color: #1F269D; font-size: 20px; margin-left: 0px;"><b>Edit Player Stats:</b></p> <p style="color: #1F269D; font-size: 20px; margin-left: 0px;"><span style="color: #1F269D; font-size: 16px; margin-left: 0px;">Powerplay Goals & Shorthanded Goals are not to be added to points total - all goals scored should be added to goals column and these are added to total points. </span></p> <?php if( isset($_SESSION['msg']) ) echo $_SESSION['msg']; if (isset($_REQUEST['act'])) { $act = $_REQUEST['act']; } if (isset($_REQUEST['stat'])) { $stat = $_REQUEST['stat']; } if ($stat==1) { // normal players $table = "players"; } else { // snl_players $table ="snl_players"; } switch($act){ case "editdo": $query = "UPDATE `$table` SET `Nationality` = '{$_POST['Nationality']}', `GamesPO` = '{$_POST['GamesPO']}', `AssistsPO` = '{$_POST['AssistsPO']}', `GoalsPO` = '{$_POST['GoalsPO']}', `PPGoalsPO` = '{$_POST['PPGoalsPO']}', `SHGoalsPO` = '{$_POST['SHGoalsPO']}', `PointsPO` = '{$_POST['PointsPO']}', `PIMPO` = '{$_POST['PIMPO']}' , `PIM` = '{$_POST['PIM']}' , `PointsCup` = '{$_POST['PointsCup']}' , `PIMCup` = '{$_POST['PIMCup']}' , `AssistsCup` = '{$_POST['AssistsCup']}' , `GoalsCup` = '{$_POST['GoalsCup']}' , `PPGoalsCup` = '{$_POST['PPGoalsCup']}' , `SHGoalsCup` = '{$_POST['SHGoalsCup']}' , `GamesCup` = '{$_POST['GamesCup']}' , `Points` = '{$_POST['Points']}' , `Assists` = '{$_POST['Assists']}' , `Goals` = '{$_POST['Goals']}' , `PPGoals` = '{$_POST['PPGoals']}' , `SHGoals` = '{$_POST['SHGoals']}' , `TeamID` = '{$_POST['TeamID']}' , `Player` = '{$_POST['Player']}' , `Games` = '{$_POST['Games' ]}' WHERE `PlayerID` = '{$_GET['PlayerID']}'"; $result = mysql_query($query) or die (mysql_error()); $_SESSION['msg'] = "The player has been updated. No. of records updated, ". mysql_affected_rows(); echo ("The player has been updated. No. of records updated, ".mysql_affected_rows()."<br><br><a href=\"playerstats.php\"> Go back to the player List</a>"); break; } if (strcmp($act, 'edit')==0) { $query11 = "SELECT * FROM `$table` WHERE `PlayerID` = '$PlayerID'"; $result11 = mysql_query($query11) or die (mysql_error()); $rows = mysql_fetch_array($result11); $PlayerID = $rows['PlayerID']; $TeamID = $rows['TeamID']; $Team = $rows['Team']; $Player = $rows['Player']; $Games = $rows['Games']; $Goals = $rows['Goals']; $PPGoals = $rows['PPGoals']; $SHGoals = $rows['SHGoals']; $Assists = $rows['Assists']; $PIM = $rows['PIM']; $Points = $rows['Points']; $GamesCup = $rows['GamesCup']; $GoalsCup = $rows['GoalsCup']; $PPGoalsCup = $rows['PPGoalsCup']; $SHGoalsCup = $rows['SHGoalsCup']; $AssistsCup = $rows['AssistsCup']; $PIMCup = $rows['PIMCup']; $PointsCup = $rows['PointsCup']; /* $GamesNPL = $rows['GamesNPL']; $GoalsNPL = $rows['GoalsNPL']; $PPGoalsNPL = $rows['PPGoalsNPL']; $SHGoalsNPL = $rows['SHGoalsNPL']; $AssistsNPL = $rows['AssistsNPL']; $PIMNPL = $rows['PIMNPL']; $PointsNPL = $rows['PointsNPL']; */ $GamesPO = $rows['GamesPO']; $GoalsPO = $rows['GoalsPO']; $PPGoalsPO = $rows['PPGoalsPO']; $SHGoalsPO = $rows['SHGoalsPO']; $AssistsPO = $rows['AssistsPO']; $PIMPO = $rows['PIMPO']; $PointsPO = $rows['PointsPO']; $Nationality = $rows['Nationality']; $query11 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'"; $result11 = mysql_query($query11) or die (mysql_error()); $rows = mysql_fetch_array($result11); $TeamName = $rows['TeamName']; echo ("<form name=\"form1\" method=\"post\" action=\"playerstats.php?act=edit&PlayerID=$PlayerID&stat=$stat\"> <table width=\"80%\" border=\"0\"> <tr> <td width=\"30%\" class=\"data\">Player Name </td> <td width=\"70%\"><input name=\"Player\" type=\"text\" id=\"Player\" value=\"$Player\"></td> </tr> <tr> <td class=\"data\">Associated Team ID </td> <td class=\"data\"> <select name=\"TeamID\">"); $query11 = "SELECT * FROM `teams`"; $result11 = mysql_query($query11) or die (mysql_error()); while ( $rows = mysql_fetch_array($result11) ) { $TeamName = $rows['TeamName']; $TeamID2 = $rows['TeamID']; if (strcmp($TeamID,$TeamID2)==0) { echo(" <option value=\"$TeamID2\" selected>$TeamName</option>"); } else { echo(" <option value=\"$TeamID2\">$TeamName</option>"); } } echo("</select></td> </tr> <tr> <td class=\"data\">Games</td> <td><input name=\"Games\" type=\"text\" id=\"Games\" size=\"6\" value=\"$Games\"></td> </tr> <tr> <td class=\"data\">Goals</td> <td><input name=\"Goals\" type=\"text\" id=\"Goals\" size=\"6\" value=\"$Goals\"></td> </tr> <tr> <td class=\"data\">PPGoals</td> <td><input name=\"PPGoals\" type=\"text\" id=\"Goals\" size=\"6\" value=\"$PPGoals\"></td> </tr> <tr> <td class=\"data\">SHGoals</td> <td><input name=\"SHGoals\" type=\"text\" id=\"Goals\" size=\"6\" value=\"$SHGoals\"></td> </tr> <tr> <td class=\"data\">Assists</td> <td><input name=\"Assists\" type=\"text\" id=\"Assists\" size=\"6\" value=\"$Assists\"></td> </tr> <tr> <td class=\"data\">PIM</td> <td><input name=\"PIM\" type=\"text\" id=\"PIM\" size=\"6\" value=\"$PIM\"></td> </tr> <tr> <td class=\"data\">Points</td> <td><input name=\"Points\" type=\"text\" id=\"Points\" size=\"6\" value=\"$Points\"></td> </tr> <tr> <td class=\"data\">GamesCup</td> <td><input name=\"GamesCup\" type=\"text\" id=\"GamesCup\" size=\"6\" value=\"$GamesCup\"></td> </tr> <tr> <td class=\"data\">GoalsCup</td> <td><input name=\"GoalsCup\" type=\"text\" id=\"GoalsCup\" size=\"6\" value=\"$GoalsCup\"></td> </tr> <tr> <td class=\"data\">PPGoalsCup</td> <td><input name=\"PPGoalsCup\" type=\"text\" id=\"GoalsCup\" size=\"6\" value=\"$PPGoalsCup\"></td> </tr><tr> <td class=\"data\">SHGoalsCup</td> <td><input name=\"SHGoalsCup\" type=\"text\" id=\"GoalsCup\" size=\"6\" value=\"$SHGoalsCup\"></td> </tr> <tr> <td class=\"data\">AssistsCup</td> <td><input name=\"AssistsCup\" type=\"text\" id=\"AssistsCup\" size=\"6\" value=\"$AssistsCup\"></td> </tr> <tr> <td class=\"data\">PIMCup</td> <td><input name=\"PIMCup\" type=\"text\" id=\"PIMCup\" size=\"6\" value=\"$PIMCup\"></td> </tr> <tr> <td class=\"data\">PointsCup</td> <td><input name=\"PointsCup\" type=\"text\" id=\"PointsCup\" size=\"6\" value=\"$PointsCup\"></td> </tr> "); if ($stat!=1) { echo(" <tr><td class=\"data\">GamesPO</td> <td><input name=\"GamesPO\" type=\"text\" id=\"GamesPO\" size=\"6\" value=\"$GamesPO\"></td> </tr> <tr> <td class=\"data\">GoalsPO</td> <td><input name=\"GoalsPO\" type=\"text\" id=\"GoalsPO\" size=\"6\" value=\"$GoalsPO\"></td> </tr> <tr> <td class=\"data\">PPGoalsPO</td> <td><input name=\"PPGoalsPO\" type=\"text\" id=\"GoalsPO\" size=\"6\" value=\"$PPGoalsPO\"></td> </tr> <tr> <td class=\"data\">SHGoalsPO</td> <td><input name=\"SHGoalsPO\" type=\"text\" id=\"GoalsPO\" size=\"6\" value=\"$SHGoalsPO\"></td> </tr><tr> <td class=\"data\">AssistsPO</td> <td><input name=\"AssistsPO\" type=\"text\" id=\"AssistsPO\" size=\"6\" value=\"$AssistsPO\"></td> </tr><tr> <td class=\"data\">PIMPO</td> <td><input name=\"PIMPO\" type=\"text\" id=\"PIMPO\" size=\"6\" value=\"$PIMPO\"></td> </tr><tr> <td class=\"data\">PointsPO</td> <td><input name=\"PointsPO\" type=\"text\" id=\"PointsPO\" size=\"6\" value=\"$PointsPO\"></td> </tr><tr> <td class=\"data\">Nationality</td> <td><input name=\"Nationality\" type=\"text\" id=\"Nationality\" value=\"$Nationality\"></td> </tr> <td class=\"data\"> </td> <td> </td> </tr> <tr> <td class=\"data\"> </td> <td><input type=\"submit\" name=\"Submit\" value=\"Edit\"></td> </tr> </table> </form>"); } } elseif (strcmp($act,'teamlist')==0) { $query112 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'"; $result112 = mysql_query($query112) or die (mysql_error()); $rows2 = mysql_fetch_array($result112); $TeamName = $rows2['TeamName']; $Logo = $rows2['Logo']; if ($Logo!="") { echo("<img src=\"../Images/$Logo\" /><br><br>"); } echo ("<strong>Edit $TeamName Players</strong><br><br>Click Player Names to edit details<br><br>"); $query11 = "SELECT * FROM `players` WHERE `TeamID` = '$TeamID'"; $result11 = mysql_query($query11) or die (mysql_error()); while ( $rows = mysql_fetch_array($result11) ) { $Player = $rows['Player']; $PlayerID = $rows['PlayerID']; $TeamID = $rows['TeamID']; echo ("<span class=\"style1\"><a href=\"playerstats.php?act=edit&PlayerID=$PlayerID&stat=1\">$Player</a><br>"); } } else { echo ("Click Team Names to view players<br><br>"); $query11 = "SELECT distinct TeamID FROM `players` ORDER BY `TeamID`"; $result11 = mysql_query($query11) or die (mysql_error()); $TeamID_in = ""; while ( $rows = mysql_fetch_array($result11) ) { //$TeamID = $rows['TeamID']; $TeamID_in .= "'".$rows['TeamID']."',"; } $TeamID_in = (substr($TeamID_in,-1) == ",") ? substr($TeamID_in, 0, -1) : $TeamID_in; // $query112 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'"; $query112 = "SELECT * FROM `teams` WHERE `TeamID` IN ($TeamID_in)"; $result112 = mysql_query($query112) or die (mysql_error()); $rows2 = mysql_fetch_array($result112); $TeamName = $rows2['TeamName']; echo ("<span class=\"style1\"><a href=\"playerstats.php?act=teamlist&TeamID=$TeamID&stat=1\">$TeamName</a><br>"); } echo ("<a name=\"snl\"></a><br><strong><a href=\"snlplayerstats.php\">SNL Teams</a></strong><br><br>"); ?> <p> </p> <p> </p> <p> <label> </label> </p> <p> <label></label> </p> <p></p> <p> </p> <p> </p> <p><a href=""></a></p> </td> </tr> </table> <div align="center"><img src="images/hr01.gif" width="556" height="11" alt="" border="0"></div> </td> </tr> <tr valign="bottom" bgcolor="#D0E0ED"> <td bgcolor="#E7BD1D"><img src="images/bot_left.gif" width="183" height="21" alt="" border="0"></td> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" width="780" height="64" background="images/fon_bot.gif"> <tr valign="top"> <td> <table border="0" cellpadding="0" cellspacing="0" width="780" background=""> <tr> <td width="300"><p class="menu02">Designed by Steven McLean</p></td> <td> <p class="menu02"><a href="">FifeFlyers.co.uk Admin Home</a></p> </td> </tr> </table> </td> </tr> </table> </td> <td valign="bottom" background="images/bg_right.gif"><img src="images/bg_right.gif" alt="" width="17" height="16" border="0"></td> <td width="50%" background="images/bg.gif"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td> </tr> </table> </body> </html> I fixed a few random bugs as well *untested* But it needs re-working
-
Have you even tested to see if $_POST['customer_id'] is being passed as EVERYONE has asked but you haven't said! or at least can we see that form ?
-
If the code i posted doesn't work then i guess i would need a more complete picture as without more detail is almost impossible to say whats wrong
-
small update echo $staff[((time()+3*24*3600)/(7*24*3600)) % count($staff)];
-
okay first of all add, in your database do you have a primary key that is auto-numbered ? I assume you have and its name is ID, okay first add a text field to your form, where call that ID as well <input type="text" name="ID" value="<?php echo ($row['ID']); ?>" /> Don't worry about what it looks like for now where going to hide it later, also add a add a submit button Now on updaterates.php we're going to need to take ID and update the rates1 of that record so the code should look like this (basic example) <?php //Check IF ID was posted if(!empty($_POST['ID'])){ //DATABASE connection etc //Query, $query="UPDATE table SET rates1='".$_POST['rates1']."' WHERE ID=".$_POST['ID']; } ?> Now change the text field to hidden field <input type="hidden" name="ID" value="<?php echo ($row['ID']); ?>" />
-
The problem is, you have only posted the code that deals with the creating the Category drop down but what code run when you click search, is it possible to post the whole page or at least the part that handles the GET/POST requests Please make sure you put the code in-between code tags (click the # button)
-
Well Insert is a query !?! but anyways Create 2 a script that accepts 3 parameters (List, Add, Name) /index.php?List=Usernames Would be used to list all users /index.php?Add=Username&Name=MadTechie would be used to Add a User
-
The code "given" was your code but cleaned up! Also it sounds like you posted the drop down list that you just said was working!! So the broken code is ?
-
checkboxes in form are not inserting to mysql
MadTechie replied to turpentyne's topic in PHP Coding Help
Need to see more code, -
Tell me about it!!!! Here action=search.php method=get> Keyword : <input type=text name=k /> Category : <select name=b> <option value=0>All</option> <?php $connection = mysql_connect('127.0.0.1', 'vale_view', '[REMOVED]' ); if (!$connection) { die ("Could not connect to the database: <br />". mysql_error()); } $db_select=mysql_select_db('vale_view'); if (!$db_select) { die ("Could not select the database: <br />". mysql_error()); } $query= "SELECT catid,catname FROM categories order by catname"; $result = mysql_query( $query ) or die('die'); if (!$result) { die ("Could not query the database: <br />". mysql_error()); } while ($result_row = mysql_fetch_row($result)) { echo "<option value=".$result_row[0].">".$result_row[1]."</option>"; } mysql_close($connection); ?> </select> Also what you do mean by "not working" ?
-
Your probably kick yourself $date = date('G:i', $row_teams['startTime'] + 2*60*60); // this date looks like this 15:30
-
Yep but case the error is on another line
-
probably a SQL error, have you checked ?
-
this is not a job for PHP, its a client side job IE javascript!
-
did you add jcbones code and if so what was displayed and did you echo $_POST['customer_id'] as hoogie suggested ? whats your code look like at the moment
-
checkboxes in form are not inserting to mysql
MadTechie replied to turpentyne's topic in PHP Coding Help
The thing about checkboxes is they are only passed if they are checked, so your code should look like this green_leaf was <?php if(isset($_POST['green_leaf'])){ echo "checked"; }else{ echo "NOT checked"; } ?> <input type="checkbox" name="green_leaf" value="<?php if(isset($_POST['green_leaf'])) echo 'checked="checked"' ?>" > green Hope that helps