Jump to content

form data is not saving in to database if i use fancybox in php


mrinalkumarjha

Recommended Posts

<?php
var_dump($_GET['u']);
include("connection.php");
include("uploadimage.php");
<pre lang="PHP">if(isset($_POST['txtStartup']))
{
$sName = $_POST["txtStartup"];
$sUserName = '';
if(isset($_GET['u']))
{
$sUserName = $_GET['u'];
}
else
{
header("location:index.php");
}
uploadimage();
$sDescription = $_POST["txtDescription"];
$sSql = "INSERT INTO communities(name, description, ownerid, image)VALUES('$sName', '$sDescription', '$sUserName', '$newfilename')";
$result = mysql_query($sSql);
if($result > 0)
{
echo "go";
echo "<script>alert('Startup created..!!')</script>";
}
else
{
echo "no";
echo "<script>alert('Startup already exists..!!')</script>";
}
}
else
{
echo "<script>alert('There are some problem while processing request..!!')</script>";
}

 

?>
<style>
body{margin: 2px 2px 0px 2px; font-family: Courier New;}
input[type=text], textarea {
-webkit-transition: all 0.30s ease-in-out;
-moz-transition: all 0.30s ease-in-out;
-ms-transition: all 0.30s ease-in-out;
-o-transition: all 0.30s ease-in-out;
outline: none;
padding: 3px 0px 3px 3px;
margin: 5px 1px 3px 0px;
border: 2px solid #DDDDDD;
-webkit-border-radius: 11px 10px 12px 10px;-moz-border-radius: 11px 10px 12px 10px;border-radius: 11px 10px 12px 10px;
width:236px;
}
 
input[type=text]:hover, textarea:hover {
box-shadow: 0 0 5px rgba(81, 203, 238, 1);
padding: 3px 0px 3px 3px;
margin: 5px 1px 3px 0px;
border: 2px solid rgba(81, 203, 238, 1);
-webkit-border-radius: 11px 10px 12px 10px;-moz-border-radius: 11px 10px 12px 10px;border-radius: 11px 10px 12px 10px;
}
#dvMain{border-radius: 1px;}
/* input[type=button]{width: 77px; background-color:#003366;border-radius: 5px; color: white ;border: 1px solid #000066;}
input[type=button]:hover{background-color:#9dbcda;} */
table{background-color: #ffffff;}
.p{color: #ff6347;font-family: Comic Sans MS;font-size: 11px;font-style: normal;}
.btn, .btn input[type=image]{float: left; width: 76px;height: 26px;background-color:#003366;border-radius: 5px; color: white ;border: 0px solid #000066;}
td{border: 0px solid #ffffff;}
tr:hover{background-color:#FAFAFA;}
 
</style>
<script type="text/javascript">
function validate() {
var name = document.getElementById("txtStartup");
if(name.value == "")
{
alert('You must enter startup name');
return false;
}
return true;
}
</script>
 
<html>
<title>Add Startup</title>
<body style='background-color:#006666; width: 500px;'>
<center>
<form action="" method="post" enctype="multipart/form-data">
<div id='dvMain' style='border: 0px solid #ff6347; height: 465px; width: 600px; background-color:#FAFAFA'>
<div style='margin: 47px;'>
<p style="color: #003d4c;font-family:Courier New; font-size: 22;">CREATE STARTUP</p>
<table style="border: 0px solid #ffffff">
<tr><td style="border: 0px solid #ffffff" colspan='3'></td></tr>
<tr><td style="border: 0px solid #ffffff">Name:</td><td style="border: 0px solid #ffffff"><input type='text' id="txtStartup" name='txtStartup' placeholder='enter startup name'></td></tr>
<tr><td>Description:</td><td><textarea name='txtDescription' placeholder='Describe community'></textarea></td><td></td></tr>
<tr><td width="150">Upload image:</td><td><input type="file" name="file" id="file"></td><td></td></tr>
 

<tr><td ></td><td><div class="btn">
<input type="image" name="btnSubmit" value="Create me" onclick="return validate();" >
</div>
<div class="btn" style="margin-left: 10px;">
<input type="image" name='btnClose' value='Close me' onclick="window.close();">
</div>
</td>
<td>
 
</td></tr>
 
</table>
<div>
<div>
   
 

 
</form>
<br/><br/><br/>
<marquee direction="left" scrollamount="1">
<p class="p"> What is startup ? Brief startup here for user information ...!!</p>
</marquee>
</center>
</body>
</html>
 

---------------------------------------

 

I am using fancybox to open this page and submit data in db. this works in normal popup like in window.open. But it does not save form data in db if i use fancybox.
 
Here are code which i use to open this page using fancy box
 
<a class="popup" href="{$url}/skin/community/addcom.php?a=profile&u={$username}"></span>Add Startups</a>
 

Please suggest where i am wrong..

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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