When i use an html form to post a file, how do i address that file's contents in php?
will this work?
$data = $_POST['file'];
$pre = explode(";;;", $data);
the file is a text file btw
UPDATE
the csv is field enclosed with ::: and lines terminated by ;;;. How can i load this into a variable without breaking the php script, which is w...
Hello I have use DOMDocs in the past but I am stuck how to do this.
$xmldoc = new DOMDocument();
$xmldoc->load('http://example.com');
$feeditem = $xmldoc->getElementsByTagName('data);
I only want the first instance of the tag 'data'. Ordinarily I would write a foreach loop:
foreach($feeditem as $element){ //}
and do what i want wi...
I have data that contains links for a navigation bar. It should be structured exactly like an unordered list, with a header and then all of the corresponding links below that header. I cannot seem to build this correctly. This would be some sample data from the database.
HEADING LIST LINK
Favs google http://...
Favs ...
I need to create a new line of data within an array where the line number = a given number
pseudo code
$info = array("Breakfast", "Lunch", "Dinner");
$target = "1"; //define where i want new data, pushing other data down
$inject = "Brunch";
$newarray = somefunction($info, $target, $inject);
$newarray now looks like
[0]Breakfast
[1]...
I'm in the process of implementing an ultra-light MVC framework in PHP. It seems to be a common opinion that the loading of data from a database, file etc. should be independent of the Model, and I agree. What I'm unsure of is the best way to link this "data layer" into MVC.
Datastore interacts with Model
//controller
public function...
As we have CPAN Libraries in Perl, do we have similar kind in PHP ? actually am new to PHP and was not sure about this.
...
Well, I might as well start a new thread. This isn't working as I had hoped. Here is the array that is being built from the database. Notice how sidebar[0] and sidebar[1] rpeat the value "Favs". This will repeat the same value on my form which I don't want. All of the duplicate names should be grouped together. Is this possible?
Array...
I have CSV text thats stored in the session array as csv. The lines are terminated by ### and fields terminated by %%.
I also have a line number of a line within that array which is CID, or the line which i want to clone.
I need to find that line within the csv array, splice it, and then update the session variable with the spliced arra...
Hey dear stackoverflow members,
I have set up a small script to use the known cUrl feature of curl_multi_* code to provide asynchronous non-blocking requests , this is a rough version of the code:
$mch = curl_multi_init();
$ch = curl_init();
url_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
cu...
Previously using Ocular 0.25 I was able to set an object as a view data, that I could access in the view: like:
$b= new book(); $b->get_where("id",5);
$this->ocular->set_view_data("b", $b);
//could be accessed in view as $b
but in the new Ocular 1.0.1, when I try to set a data mapper object it gives me a blank screen, without an...
Hello All,
I have an IF statement that consists of two separate function calls
passing values to two variables. Obviously if neither value is 'FALSE'
then the code block is executed:
<?php
class MyValidater {
static function validateString($string) {
if (preg_match("/[A-Za-z]+/", $string)) {
return $string...
Hi,
I had an idea to work on a livescore site with some additions, however before even trying to work on one, I would like to know from where such sites get their data from?
Thanks for any answer.
...
Is there any FREE script available for online customer support in AJAX, JQUERY , php
like person have own window to chat ...
Thanks
...
Hello I have the variable
$string[$k] = $function[$k]
defined within a foreach loop with index $k. I want $string to be defined as
$string[$k] = $function[$(k-5)]
except that isn't correct. So for $k=8 I would have
$string[8] = $function[3]
How do I achieve this?
Thank you
...
How can I add a text behind a form element in Zend Framework? Let's say I have a text input field, first there is a label, bellow the label there is an actual input field but I want to add some additional text (2-3 sentences) behind the input field. Something like a short tip or suggestion what is the best value for that field.
...
I'm writing an interposition library to track the usage of some library functions in libc, such as open(), close(), connect(), etc. It works generally well on most of the applications. However, when I try it with PHP, using PHP's MySQL module in particular, none of the function calls to libc inside this module is been tracked (so no conn...
In my website, website.com/downloads actually goes to website.com/index.php?page=downloads (with apache rewriting). I have a custom 404 not found error page set. If I do website.com/dkfjf/fdf, It goes to the 404 error, but If I do website.com/something, it goes to index.php?page=something, so then in my index.php, how can I make it just ...
I can't wrap my head around PEAR or its usages. There is also some talk about its maintainability, so I think a better way to help me gauge what sub-components of my programs I could need it for is to ask what others have used it for. What did you use PEAR for and it was a good choice? and what did you consider using it for but eventuall...
I am creating a tool with which to edit web pages within a CMS.
The main goal of the tool is total flexibility for the user. Therefore, a great number of properties can be edited in it - properties like these (snippet):
langbutton_menu_border_color_left
langbutton_menu_border_width_left
langbutton_menu_border_style_left
langbutton_men...
I'm playing around with prepared statements in PHP/PDO. The basic queries work fine, passing a value to the WHERE clause:
$stmt = $db->prepare( 'SELECT title FROM episode WHERE id=:id' );
$stmt->bindParam( ':id', $id, PDO::PARAM_INT );
$id = 5;
$stmt->execute();
However I have a situation where I need to pass variables for the field n...