forumnz Posted May 12, 2007 Share Posted May 12, 2007 Why wont this work? <html> <body> <?php error_reporting(E_ALL); ini_set('display_errors', '1'); if ($submit) { $stg2 = 'gallery/'.$_POST['stg2']; // process form $db = mysql_connect("localhost", "photomagik", "----"); mysql_select_db("photomagik_co_nz_-_soho",$db); $sql = "UPDATE mag set on='$on',stg1='$stg1',stg2='$stg2',stg3='$stg3' WHERE id='$nm'"; $result = mysql_query($sql); //echo $sql; echo "Thank you! Information entered. <a href=edit.php>Back...</a>\n"; } else{ // display form ?> <form method="post" action="<?php echo $PHP_SELF?>"> <p>1: <input name="nm" type="checkbox" value="1"> <br /> 2: <input name="nm" type="checkbox" value="2"> <br /> 3: <input name="nm" type="checkbox" value="3"> <br /> 4: <input name="nm" type="checkbox" value="4"> <br /> 5: <input name="nm" type="checkbox" value="5"> <br /> 6: <input name="nm" type="checkbox" value="6"> <br /> Link <input type="Text" name="stg2"> <br> Image <input type="Text" name="stg1"> <br> Text <input type="Text" name="stg3"> </p> <p>Activate? Yes <input name="on" type="checkbox" value="1"> <br> <input type="Submit" name="submit" value="Enter information"> </p> </form> <?php } // end if ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/51025-very-simple-cms/ Share on other sites More sharing options...
jitesh Posted May 12, 2007 Share Posted May 12, 2007 if ($_POST['submit']) { Link to comment https://forums.phpfreaks.com/topic/51025-very-simple-cms/#findComment-251090 Share on other sites More sharing options...
Trium918 Posted May 12, 2007 Share Posted May 12, 2007 What is the result when you try to run this script? Link to comment https://forums.phpfreaks.com/topic/51025-very-simple-cms/#findComment-251091 Share on other sites More sharing options...
mmarif4u Posted May 12, 2007 Share Posted May 12, 2007 $stg2 = 'gallery/'.$_POST['stg2']; $sql = "UPDATE mag set on='$on',stg1='$stg1',stg2='$stg2',stg3='$stg3' WHERE id='$nm'"; Where u set ur form fields like: $stg1,$stg3,$on,$nm... From where it will be insert to db. Link to comment https://forums.phpfreaks.com/topic/51025-very-simple-cms/#findComment-251092 Share on other sites More sharing options...
forumnz Posted May 12, 2007 Author Share Posted May 12, 2007 What is the result when you try to run this script? I am trying to update that database - i dont really get it. $stg2 = 'gallery/'.$_POST['stg2']; $sql = "UPDATE mag set on='$on',stg1='$stg1',stg2='$stg2',stg3='$stg3' WHERE id='$nm'"; Where u set ur form fields like: $stg1,$stg3,$on,$nm... From where it will be insert to db. I don't get what you mean? Link to comment https://forums.phpfreaks.com/topic/51025-very-simple-cms/#findComment-251093 Share on other sites More sharing options...
mmarif4u Posted May 12, 2007 Share Posted May 12, 2007 $stg2 = 'gallery/'.$_POST['stg2']; $sql = "UPDATE mag set on='$on',stg1='$stg1',stg2='$stg2',stg3='$stg3' WHERE id='$nm'"; Where u set ur form fields like: $stg1,$stg3,$on,$nm... I mean u want to update ur table with variables like: $stg1,$on and so on... U just mention one variable which is $stg2.But from where the others u want to update. Link to comment https://forums.phpfreaks.com/topic/51025-very-simple-cms/#findComment-251094 Share on other sites More sharing options...
trq Posted May 12, 2007 Share Posted May 12, 2007 Why wont this work? Because it contains allot of undefined variables. For instance, where are $submit, $stg1, and $stg2 defined? Answer, there not. Try looking for them in the $_POST array (eg; $_POST['stg1']). Link to comment https://forums.phpfreaks.com/topic/51025-very-simple-cms/#findComment-251096 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.