PHP - Help Moving
Hi everyone can anyone tell me why my code displays fine in the test environment but doesn't display in the live?
Does the paths have to be different? //$conn = odbc_connect('myEvents','',''); $dbFile = realpath('Databases/myEvents.mdb'); $dbDir = dirname($dbFile); $conn = odbc_connect("Driver={Microsoft Access Driver (*.mdb)};DBQ=$dbFile;" , '', ''); $sql= "SELECT month,day,year,time,event,location FROM Events ORDER By ID"; $rs="$conn,$sql"; Similar TutorialsI am moving to a different hosting site that is using php 5.2 from one that has 5.3. I am running into an error with my session_start() that worked just fine before. Was wondering if I could get some pointers. These are the errors that I get Quote Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started atindex.php:10) in header.php on line 5 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at index.php:10) in header.php on line 5 Notice: Undefined index: login in header.php on line 6 Notice: Undefined index: rank in header.php on line 7 Notice: Undefined variable: loggedinusername in header.php on line 8 Notice: Undefined variable: loggedinuseremail in header.php on line 9 Warning: Cannot modify header information - headers already sent by (output started at index.php:10) in header.php on line 10 Notice: Undefined index: rank in header.php on line 15 This is what I have in my header that is included in every page. Code: [Select] 4 <? 5 session_start(); 6 if(!$_SESSION['login']){ 7 $_SESSION['rank']; 8 $_SESSION['loggedinusername'] = $loggedinusername; 9 $_SESSION['loggedinuseremail'] = $loggedinuseremail; 10 header("location:login.php"); 11 } 12 ?> 13 14 <?php 15 $rank=$_SESSION['rank']; 16 $loggedinusername=$_SESSION['loggedinusername']; 17 $loggedinuseremail=$_SESSION['loggedinuseremail']; 18 ?> Hey, Im new here (First post) and I need some help with variables. At the moment I have one main file where all variables have been defined and this page has been included in every page that has been made for the rest of the site. It defines them like this: Code: [Select] $query="SELECT * FROM user WHERE name='$name'"; $result=mysql_query($query); $result=mysql_fetch_array($result); $name=$result["name"] $money=$result["money"]; But users are able to change variables using the URL e.g www.test.com/index.php?money=1000000. That would then say they have 1,000,000 money on that page but when they change the page it will go back to the amount that is in the database. I would like to stop this as its not good for the site and there has to be a better way to be doing this. I would like to learn about this so any help would be great. I would like it if someone could add me on skype or somthing like that to help me do this faster then posting on a forum. Thank you very much, Alex I have a form on my web site for rating movies that uses radios. I would like to move away from that to a line of images where a user can click on there rating depending on which number down the line they click. I'm not sure if this should be done making the image into a submit or just a link. Here is what I have right now with the radios that works, this does feed into jquery so the user dosent have to leave the page. Any pointers and opinions are welcome. Thank you. Code: [Select] <form id="add-rating"> <input type="radio" name="MOVIE_RATING" value="1" > 1 <input type="radio" name="MOVIE_RATING" value="2" > 2 <input type="radio" name="MOVIE_RATING" value="3" checked="yes"> 3 <input type="radio" name="MOVIE_RATING" value="4" > 4 <input type="radio" name="MOVIE_RATING" value="5" > 5 <br> <input type="hidden" name="MOVIE_ID" value="<?php echo $id; ?>"> <input type="hidden" name="MOVIE_TITLE" value="<?php echo stripslashes($title); ?>"> <input type="hidden" name="USER_ID" value="<?php echo $loggedinusername; ?>"> <input type="submit" value="Rate"> </form> I have a directory in public WWW. The files throughout the directory have many PHP includes amongst themselves. For example, the file "registration.php" begins with require('../parameters.php'); The directory is complex, like this:
/Public WWW directory/ How would I do that without breaking all the include paths? (I know the solution is probably a one-liner involving __DIR__ ... but I can't seem to code it so it works). Thank you!!
Hello,
I'm pretty new at building websites using php (and mysql) and was most recently given the task to create a database image gallery, which was to be accessed through a php website.
I made a full site which allowed me to upload said images & it worked perfectly. However after doing my last checks I have been told that mysql is deprecated and that I need to use mysqli.
I've had a look at some tutorials on websites to help direct me but it's simply confusing me more and more each time I look at it.
Is it possible I am over thinking this and there is an easier way to approach it?
Thank you kindly.
This is my php code:
Hello I am using the code:
<?php I am trying to find a good IDE for PHP and JavaScript. I fiddled around with Visual Code and it was very buggy. The GitHub page said over 800 open errors?!?!? Now I'm looking at PHPStorm and it reads that only PHP in a PHP page or JavaScript in a JavaScript page may be debugged. I am wondering if this is always possible to separate the code like this.
Also, in the following code, what do you all think about using a XMLHttpRequest() to call this right in the beginning of the page with no button or anything. Is this bad form? It creates a dropdown list from the database. Right now it just sits there. This code isn't ready for prepare yet.
<?php $host = 'localhost'; $user = 'root'; $pass = ''; $database = 'ecommerce'; $options = array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_EMULATE_PREPARES => false ); $dbo = new PDO("mysql:host=$host;dbname=$database", $user, $pass, $options); $q4 = "SELECT categories.title FROM categories INNER JOIN customers on customers.CustomerID = categories.CustomerID and customers.CustomerID = 1"; echo '<select id = "dropDown1" >'; foreach ($dbo->query($q4) as $row) { echo "<br>"; echo '<option value = " '; echo $row['title']; echo '">'; echo $row['title']; echo '</option>'; } echo "<br>"; echo '</select>'; ?> I'm using AJAX.
Edited January 2 by JoshEir warning: I'm a self taught advanced newbie. I'm working on a multipage PHP app that has need to pass values between pages, usually very small text strings or small integers. I've designed it primarily using _SESSION variables to pass these bits of data. Some of them are written to SQL, but most of them are temporary in nature. Is using _SESSION variables in this capacity considered reasonable? Is there something else or a different way to go about this? (Page A writes a value into $_SESSION['myvalue'], and then page B grabs that data and does something with it.) Hi, somehow iv managed to add pagination to my project, but im struggling with one thing - i dont know how to move the pagination "symbols" (idk how they r called).. here's a pic that will explain what im talking about: and heres the code that im using: //The directory to your images folder, with trailing slash $dir = "uploads/thumbs/watermarkedthumbs/"; //Set the extensions you want to load, seperate by a comma. $extensions = "jpeg,jpg"; //Set the number of images you want to display per page $imagesPerPage = 4; //Set the $page variable if(!isset($_GET['page'])){ $page = 1; }else{ $page = $_GET['page']; } //Load all images into an array $images = glob($dir."*.{".$extensions."}", GLOB_BRACE); //Count the number of images $totalImages = count($images); //Get the total pages $totalPages = ceil($totalImages / $imagesPerPage); //Make sure the page you are on is not greater then the total pages available. if($page > $totalPages){ //Set the currnet page to the total pages. $page = $totalPages; } //Now find where to start the loading from $from = ($page * $imagesPerPage) - $imagesPerPage; //Now start looping for($i = $from; $i < ($from + $imagesPerPage); $i++){ //We need to make sure that its within the range of totalImages. if($i < $totalImages){ //Now we can display the image! echo "<img style='border:thin solid #FFF;margin-top:10px;margin-left:10px;margin-right:10px' src='{$images[$i]}'alt='{$images[$i]}' />"; } } //Now to display the page numbers! for($p = 1; $p <= $totalPages; $p++){ if($p == $page){ $tmp_pages[] = "<strong>{$p}</strong>"; }else{ $tmp_pages[] = "<a href='?page={$p}'>{$p}</a>"; } } //Now display pages, seperated by a hyphon. echo "<br />" . implode(" - ", $tmp_pages); ?> how do i move the 'page numbers' ? thanks in advance I upload an image and put every information inside $_SESSION['tmp'] and $_SESSION['path'] then once user click on button then i use move_uploaded_file($_SESSION['tmp'],$_SESSION['path']) but file uploaded not appeared in my upload folder, and again i try to echo everything but all information still kept well in $_SESSION is there something missing here? thanks We have a 10 year old system that has 100's of php files that all connect to a central database using a single shared php include file that does a mysql_connect before any other code executes
include_once("db_connect.php");
mysql_query(...);
We never used the returned connection id (link identifier) from the mysql_connect function call as it was always implied in every subsequent mysql_query statement etc.
Now we've moved some of our bigger tables to a separate server, so we have to update small areas of some files that need to connect to this other system and send the old existing query to the new server instead of to the main server and process the results
So, going back through hundreds of files and converting mysql_query($string) to mysql_query($string, $connection1) is not practical
Possible solution one: anytime I need to use the new server I do this
------------------------------------------------------------------------------
mysql_connect(NEW_SERVER_IP,"...",""");
mysql_query($string);
...
// get back to normal
mysql_connect(OLD_SERVER_IP,"...","");
Possible solution two: modify the master include file
------------------------------------------------------------------------------
//add a new line ABOVE the existing mysql_connect statement...
$new_server=mysql_connect(NEW_SERVER_IP,"...",""");
mysql_connect(OLD_SERVER_IP,"...","");
and then anytime I need to use the new database I have to go back and modify all of the mysql_query,mysql_affected_rows, etc to reference the $new_server link identifier
solution one seems much simpler, but all of the mysql_connect reconnections I assume will be extremely inefficient
solution two seems cleaner but if I miss one mysql_ statement that needs the new connection object as a reference, the code will completely break or worse yet it will produce unexpected results
Example: If I miss converting a mysql_errno() function that really needs to now be mysql_errno($new_server) it would cause major issues.
So, I'm wondering if others have faced this dilema of migrating single mysql_connect code to multi mysql_connect mode and if there is a better way of going about implementing it.
Thanks in advance for any help
Steve
Hi I am hoping someone can help. My hosting company has just moved my website to a different server, and I noticed that it was giving me blank pages, I added in some debug and now I am getting undefined variable errors and I don't know why or how to fix it. The Page which has broken currently gets its information from the database from the url. RewriteRule ^reviews/([^/]*)\/$ /bingosite.php?h1=$1 [L] The code in the broken page that is throwing out undefined variable errors is the following: <? $query = mysql_query("SELECT * FROM link where linktype='bingo' and h1 ='".StripUrl101(ucwords($h1))."'"); { while($row =mysql_fetch_assoc($query)) extract($row);?> <? if ($linkType=="bingo") { ?> <?php echo "$h1"; ?> <? } } ?> I have used this code for years so it could be that it is old but as I only know basic PHP I am very stuck and the hosting company isn't being very helpful. Just to add if I write <? $query = mysql_query("SELECT * FROM link where linktype='bingo' and h1 ='Quick Bingo'"); { while($row =mysql_fetch_assoc($query)) extract($row);?> The results for Quick Bingo appear on the page. However it needs to work dynamically like it was doing before. If anyone can help it would be appreciated. Thanks Rachael Edited by rachae1, 17 May 2014 - 04:29 PM. I have a huge application(multi-year) where I do the normal $varX= $var1 + $var2. I get Warning: A non-numeric value encountered because var1 or var 2 are string. I know the right thing will be to intval(), but I just cant go over so much of the application. I read to just disable warning, but I think thats worst because I will not be able to see new warnings. Is there any php.ini solution were php can work as before on math operations? I guess I can ini_set on all the old files and dont do it on the new ones). If there is another accepted solution, please let me know Thank you
Hi I'm currently in the process of re-developing a website for a client in Wordpress. I've completed the work apart from the fact that on the old site the client has a webpage with an email subscription form for subscribing to a newsletter. The form takes a 'Name' and 'Email Address' and writes these to a MySQL database in the back end. I've tried adding the code to a page in wordpress and have a few plugins which allow PHP code execution on both the sidebar and page but when the button is clicked to submit the subscription nothing appears to happen as on the origonal page. I really need to know whether this type of code could be imported into Wordpress and made to work or how to go about writing a wordpress page that will write to the same database. Any advice on this would be helpful as I'm not a strong php coder. The Code is as follows: There's a contact.php page on the origoanl site that calls inc-mailing-list.php that also referrences a mysqlconnections.php file I've put all the code below for referrence. Origonal Site: contact.php Code: <?php session_start(); $string = strtoupper($_SESSION['string']); $userstring = strtoupper($_POST['userstring']); session_destroy(); ?> HTML PAGE FORMATTING (REMOVED FOR THE POST) <?php include("inc-mailing-list.php"); ?></TD> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA-9716450-1"); pageTracker._trackPageview(); } catch(err) {}</script></body> </html> INC-MAILING-LIST.PHP <?php require_once('Connections/mysqlconnection.php'); ?> <?php /* In contact.php session_start(); $string = strtoupper($_SESSION['string']); $userstring = strtoupper($_POST['userstring']); session_destroy(); */ ///// Anti sql injection if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } //// Site config $siteName = "South Wales Art Society"; $siteURL = "www.southwalesartsociety.co.uk"; $siteEmail = "info@southwalesartsociety.co.uk"; ///// Establish the current date/time as a variable $now = date('Y-m-d H:i:s'); // Current date //// Call mailing lists mysql_select_db($database_mysqlconnection, $mysqlconnection); $query_callMailingLists = "SELECT * FROM content WHERE contenttype = 501 AND onlinestatus = '1' ORDER BY displayorder ASC"; $callMailingLists = mysql_query($query_callMailingLists, $mysqlconnection) or die(mysql_error()); $row_callMailingLists = mysql_fetch_assoc($callMailingLists); $totalRows_callMailingLists = mysql_num_rows($callMailingLists); //// Unsubscribe if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "elist") && ($_POST["subscription"] == "unsubscribe") && (strlen($_POST["email"]) > 4) && ($string == $userstring) && (strlen($string) > 4)) { $deleteSQL = sprintf("DELETE FROM content WHERE email=%s AND contenttype = 500", GetSQLValueString($_POST['email'], "text")); mysql_select_db($database_mysqlconnection, $mysqlconnection); $Result1 = mysql_query($deleteSQL, $mysqlconnection) or die(mysql_error()); $status = "1"; //SEND CONFIRMATION EMAIL $to = $_POST['email']; $subject = $siteName.' Mailing List'; $body = 'Your email address has been removed from the '.$siteName.' mailing list.' . "\n\r"; $body .= $siteURL . "\n\r"; $headers = 'From: '.$siteEmail . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $body, $headers); } /////////////////// SUBSCRIPTION //////////////////////// // Insert comment if sent and valid if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "elist") && ($_POST["email"] != "") && ($_POST["subscription"] == "subscribe") && ($string == $userstring) && (strlen($string) > 4)) { //////////////////////////////////////////////////////////////////////////////////// ///////////////////////////// COUNT AND JOIN TAGS ////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// $tagCombination1 = ""; // Default value to define variable. $tagTotal = ""; // Default value to define variable. if (isset($_POST['TagsTotal1'])) { $tagTotal = $_POST['TagsTotal1'];} $tagNumber = 0; do { $tagNumber = $tagNumber+1; if (isset($_POST['Tag-1-'.$tagNumber])) $tagCombination1 = $tagCombination1.",".$_POST['Tag-1-'.$tagNumber]; // DISREGARD UNSELECTED TAGS } while ($tagNumber <= $tagTotal); // LOOP UNTIL ALL TAGS HAVE BEEN COMBINED $tagCombination1 = $tagCombination1.","; // ADD A COMMA TO THE END TO GET CORRECT SEARCH PARAMETERS $tagCombination1 = str_replace(",,",",",$tagCombination1); // CLEAR OUT ANY DOUBLE COMMAS //////////////////////////////////////////////////////////////////////////////////// /////////////////////////// COUNT AND JOIN TAGS END //////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// $insertSQL = sprintf("INSERT INTO content (contenttype, title1, email, date_added, tags1) VALUES (%s, %s, %s, %s, %s)", GetSQLValueString(500, "int"), GetSQLValueString($_POST['name'], "text"), GetSQLValueString($_POST['email'], "text"), GetSQLValueString($now, "text"), GetSQLValueString($tagCombination1, "text")); mysql_select_db($database_mysqlconnection, $mysqlconnection); $Result1 = mysql_query($insertSQL, $mysqlconnection) or die(mysql_error()); $status = "2"; //SEND CONFIRMATION EMAIL $to = $_POST['email']; $subject = $siteName.' Mailing List'; $body = 'Thank you. Your name has been added to the '.$siteName.' mailing list.' . "\n\r"; $body .= $siteURL . "\n\r"; $headers = 'From: '.$siteEmail . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $body, $headers); } ?> <div id="signup" > <H5>Sign Up For Our Mailing List</H5> <?php if (($_POST['email']) && ($status == "1")) { ?> <br /><strong>Thank you, you have been removed from the mailing list.</strong> <?php } elseif (($_POST['email']) && ($status == "2")) { ?> <br /><strong>Thank you, you have been added to the mailing list.</strong> <?php } else { ?> <form name="elist" method="POST" action=""> <?php if (($_POST['email']) && ($status != "2")) { ?><p class="red"><strong>Please complete your details and enter the code.</strong></p><?php } // Error ?> <br /> Name: <input name="name" type="text" value="<?php echo $_POST['name']; ?>" /><br /> Email: <input name="email" type="text" value="<?php echo $_POST['email']; ?>" /><br /> <input name="subscription" type="radio" id="subscription_0" value="subscribe" <?php if($_GET['unsubscribe']!="yes") { ?>checked="checked"<?php } // ?> /> Subscribe<br /> <input type="radio" name="subscription" value="unsubscribe" id="subscription_1" <?php if($_GET['unsubscribe']=="yes") { ?>checked="checked"<?php } // ?>/> Unsubscribe<br /> <br /> <?php /*?>Select which information you would like to receive:<br /> <?php $tagNumbers = 0; do { $tagNumbers = $tagNumbers+1;?> <label><input <?php if (!(strcmp($row_callMailingLists['id'],1000))) {echo "checked=\"checked\"";} ?> name="Tag-1-<?php echo $tagNumbers; ?>" type="checkbox" value="<?php echo $row_callMailingLists['id']; ?>" /><?php echo $row_callMailingLists['title1']; ?></label><br /> <?php } while ($row_callMailingLists = mysql_fetch_assoc($callMailingLists)); ?><br /><br /> <input type="hidden" name="TagsTotal1" value="<?php echo $totalRows_callMailingLists; ?>" /> USE THE TWO HIDDEN FIELDS BELOW AS THERE IS ONLY ONE LIST <?php */?> <input type="hidden" name="Tag-1-1" value="1000" /> <input type="hidden" name="TagsTotal1" value="1" /> <img src="/captcha/imagebuilder.php" alt="" border="0" /><br /><br /> <small>Please enter the code shown above.</small><br /> <input maxlength="8" size="8" name="userstring" type="password" value="" /><br /><br /> <input name="Submit" type="submit" value="Submit" /><br /> <input type="hidden" name="datesubscribed" value="<?php echo date('Y-m-d H:i:s'); ?>" /> <input type="hidden" name="MM_insert" value="elist" /> </form> </div> <?php } // ?> <?php mysql_free_result($callMailingLists); ?> Sample array: array('one','two','three','_zero'); How could I sort this array so that _zero moves to the front.. Any items that begin with an underscore should be moved to the front of the array to get something like so: _zero, one, two, three Thanks linux-file-structu what needs to be saved while moving the installation
well this is one of the best place to ask joomla-related question. today i have no question regarding joomla. today i want to ask a linux-question: i am preparing a upgrade from opensuse 13.1 to 13.2 and i want to do a fresh installation. first of all - as a preliminary task i will do a saving of all the files - that are in the home of the current installation what else shoud i safe - more than the /home/my_name should i save anyting else ... http://tldp.org/LDP/...sect_03_01.html Table 3-2. Subdirectories of the root directory Directory Content /bin Common programs, shared by the system, the system administrator and the users. /boot The startup files and the kernel, vmlinuz. In some recent distributions also grub data. Grub is the GRand Unified Boot loader and is an attempt to get rid of the many different boot-loaders we know today. /dev Contains references to all the CPU peripheral hardware, which are represented as files with special properties. /etc Most important system configuration files are in /etc, this directory contains data similar to those in the Control Panel in Windows /home Home directories of the common users. /initrd (on some distributions) Information for booting. Do not remove! /lib Library files, includes files for all kinds of programs needed by the system and the users. /lost+found Every partition has a lost+found in its upper directory. Files that were saved during failures are here. /misc For miscellaneous purposes. /mnt Standard mount point for external file systems, e.g. a CD-ROM or a digital camera. /net Standard mount point for entire remote file systems /opt Typically contains extra and third party software. /proc A virtual file system containing information about system resources. More information about the meaning of the files in proc is obtained by entering the command man proc in a terminal window. The file proc.txt discusses the virtual file system in detail. /root The administrative user's home directory. Mind the difference between /, the root directory and /root, the home directory of the root user. /sbin Programs for use by the system and the system administrator. /tmp Temporary space for use by the system, cleaned upon reboot, so don't use this for saving any work! /usr Programs, libraries, documentation etc. for all user-related programs. /var Storage for all variable files and temporary files created by users, such as log files, the mail queue, the print spooler area, space for temporary storage of files downloaded from the Internet, or to keep an image of a CD before burning it. well - reagarding the thunderbird and other things more. note: i have thunderbird and enigmail up and running. so i need to save a. the passwords b. the mails. question: is there a need to save more than the home/my_name ?! love to hear from you greetings I want to move a module, as shown in the attached jpeg. I want to move it to the position illustrated by the arrow, and I want to increase it's height so it fills the space but leaving a border. There is no module in the position that I can use, so I have to adjust the html coding (I presume). Can anyone help me with this? I have searched for help and I don't even know which file I need to change - whether it is the css or the html. Cheers, James. I think ive finished the piece of code below, after using escape string for the first time. Ive also put my connection details in a different folder on my hosting account root (worried that this would of been displayed in the event of a parsing eror), is there anything else I can do to make my site secure? Code: [Select] <?php include('func.php'); include($_SERVER['DOCUMENT_ROOT'].'/include/db.php'); ?> <!--$INC_DIR = $_SERVER["DOCUMENT_ROOT"]. "/include/";--> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Chained Select Boxes using PHP, MySQL and jQuery</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#wait_1').hide(); $('#drop_1').change(function(){ $('#wait_1').show(); $('#result_1').hide(); $.get("func.php", { func: "drop_1", drop_var: $('#drop_1').val() }, function(response){ $('#result_1').fadeOut(); setTimeout("finishAjax('result_1', '"+escape(response)+"')", 400); }); return false; }); }); function finishAjax(id, response) { $('#wait_1').hide(); $('#'+id).html(unescape(response)); $('#'+id).fadeIn(); } </script> </head> <body> <p> <form action="" method="post"> Name: <input type="text" name="Name" /><br /> Phone: <input type="text" name="Phone" /><br /> Email: <input type="text" name="Email" /><br /> Postcode: <input type="text" name="Postcode" /><br /> Web Address: <input type="text" name="Website" /><br /><br /> <select name="drop_1" id="drop_1"> <option value="" selected="selected" disabled="disabled">Select a Category</option> <?php getTierOne(); ?> </select> <span id="wait_1" style="display: none;"> <img alt="Please Wait" src="ajax-loader.gif"/> </span> <span id="result_1" style="display: none;"></span> <br /> </form> </p> <p> <?php if(isset($_POST['submit'])){ $drop = mysql_real_escape_string($_POST['drop_1']); $tier_two = mysql_real_escape_string($_POST['Subtype']); echo "You selected "; echo $drop." & ".$tier_two; } $Name = mysql_real_escape_string($_POST["Name"]); $Phone = mysql_real_escape_string($_POST["Phone"]); $Email = mysql_real_escape_string($_POST["Email"]); $Postcode = mysql_real_escape_string($_POST["Postcode"]); $Website = mysql_real_escape_string($_POST["Website"]); echo "<br>"; echo $Name; echo "<br>"; echo $Website; $query = ("INSERT INTO business (`id`, `Name`, `Type`, `Subtype`, `Phone`, `Email`, `Postcode`, `Web Address`) VALUES ('NULL', '$Name', '$drop', '$tier_two' , '$Phone', '$Email', '$Postcode', '$Website')"); mysql_query($query) or die ( "<br>Query: $query<br>Error: " .mysql_error()); ?> </body> </html>
I have a form on which the filepond plugin send the file manually
Look here if(empty($_POST['image'])) { echo 'add file!'; } $myimage = $_POST['image']; $myimage = str_replace('data:image/png;base64,', '', $myimage); $myimage = str_replace(' ', '+', $myimage); $decode = base64_decode($myimage); $myfile = $_SERVER['DOCUMENT_ROOT'].'/mages/' . uniqid() . '.png'; //now put the file file_put_contents($myfile, $decode);
This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=317771.0 |