Jump to content

Pushpender_rana

New Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by Pushpender_rana

  1. i m not able to insert data to the data base...
  2. <?php if ($_POST['cmdSubmit'] != '') { $imgName = time(); if ($_FILES['txtImage']['name'] != '') { $sql = "INSERT INTO news SET head = '".htmlspecialchars($_POST['head'], ENT_QUOTES). "', news = '". htmlspecialchars($_POST['news'], ENT_QUOTES). "', validity = '".htmlspecialchars($_POST['validity'], ENT_QUOTES)."', terms = '".htmlspecialchars( $_POST['terms'], ENT_QUOTES).'"'; $res = mysql_query($sql); if ($res) { $id = mysql_insert_id(); $source = $_FILES['txtImage']['tmp_name']; //Upload file temp Path $dest = BASEPATH . "images/news/"; //Destinaltion folder $extntion = strstr($_FILES['txtImage']['name'], "."); //Extension $newname = "Image-" . $imgName . $extntion; //File Extensions $destination = $dest . $newname; //Destination Full Path if (move_uploaded_file($source, $destination)) { $sqlup = "update news set image = '" . $newname . "' where id = " . $id; mysql_query($sqlup); } else { die('Error in Uploading File'); } } } header("location:home.php?option=news"); } ?> <table><tr><td><h2>Add Panel</h2></td></tr></table> <form name="frmAdd" action="" method="post" enctype="multipart/form-data"> <table cellpadding="2" cellspacing="2" border="1" align="center" width="85%"> <tr> <td>Heading</td> <td><input type="text" name="head"></td> <tr> <tr> <td>Image</td> <td><input type="file" name="txtImage" value="" /></td> </tr> <tr> <td>News</td> <td><input type="text" name="news" value="" /></td> </tr> <tr> <tr> <td>Validty</td> <td><input type="text" name="validity" value="" /></td> </tr> <tr> <tr> <td>Terms</td> <td><textarea name="terms" cols="40" rows="5"></textarea></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" name="cmdSubmit" value="submit"></td> </tr> </table> </form>
×
×
  • 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.