Jump to content

add directory to form...


forumnz

Recommended Posts

how can i alter this so that when stg2 is updated, it also adds gallery/ to the front of it?

 

Thanks a lot.

 

 

 

 

 

<?php

 

error_reporting(E_ALL);

ini_set('display_errors', '1');

 

 

 

if ($submit) {

 

  // process form

 

  $db = mysql_connect("localhost", "photomagik", "****");

 

  mysql_select_db("photomagik_co_nz_-_soho",$db);

 

  $sql = "UPDATE mag  set 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?>">

 

  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"><br>

 

  <input type="Submit" name="submit" value="Enter information">

 

  </form>

 

 

 

  <?php

 

 

 

} // end if

 

 

 

?>

 

Link to comment
https://forums.phpfreaks.com/topic/50077-add-directory-to-form/
Share on other sites

my bad, or you could change it to

 

$stg2 = 'gallery/'.$stg2;

 

register_globals is the php config setting where all request methods automatically register defined variables in the local environment, opens you up to all sorts of hacking attacks..

 

for instance, i could just as easily access your page  like this...

 

www.YOURDOMAIN.com/YOURSCRIPT.php?submit=1

 

and the script will think that i've posted the form and will start to process it as such.

Link to comment
https://forums.phpfreaks.com/topic/50077-add-directory-to-form/#findComment-245878
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.