Jump to content

VERY simple cms


forumnz

Recommended Posts

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

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

 

$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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.