php

some quick PHP and HTML help

Hi , Basically I will tell you what I want to do. 1: If a user is not logged in I want them to be re-directed back to the login page. 2: If a user is Logged in and they submitted a form I want them to be directed to the next page. I have tried it with meta refresh but I can only seem to get it working with one or the other. Can y...

Help with PHP and HTML form (POST + Redirect)

HI , Can any one help I need to direct the user once they have submitted the form to another page How could I do this ? <form enctype="multipart/form-data" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> ...

How can I store and retrieve images from a MySQL database using PHP?

How can I insert an image in MySQL and then retrieve it using PHP? I have limited experience in either area, and I could use a little code to get me started in figuring this out. ...

How do I have a more advanced array?

Hi there, Basically I currently put a bunch of values into an array like so: $flavors = array('Original','Cherry','Chocolate','Raspberry','Mango'); and from this I might execute a foreach like so: foreach($flavors as $flav) { echo doSomething($flav); } This all works a treat, until I get to the next stage of my learning whi...

Make php date dropdown function 'sticky'

Out of coffee and brain's given up... ...can anyone help to make this form date dropdown function retain selected month on $_POST ['submit'] or isset($missing) in the case of there being an error/missing field etc function createMonths($id='month_select', $selected=null) { /*** array of months ***/ $months = array( ...

Correct Regular expressions to match a date

What is the correct regular expression to use to validate a date like. 2009-10-22 or 2009-01-01 etc. Platform PHP ...

Sending mail to users from my site

Hi I'm using AuthSMTP which is a paid SMTP Relay service. They only support a finite amount of "from" email addresses, which must be proper accounts. This is my first site build and I'm trying to get my head around how to implement email. When a user registers with the site or forgets their password, I have an 'info' email account whi...

A listing of available PHP configuration options

Having browsed the net for a while, I've found that searching for a list of all the params available to add in the ./configure directive set when you make (compile) PHP is very hard to find since it will get you a lot of answers on how to use ini_set() and how to manipulate the php.ini file. What I'm after - and it's probably available ...

Filter and View screens on different pages

Situation: In Drupal, when you use Views module, it restricts to display Search Form and Results on the same page. E.g. Page A = (Search Form + Results). There is no option in Views module interface to move/copy Search Form to another page. E.g. Page A = Search Form, Page B = Results Form Question: Is it allowed by Views architectur...

How to get the jQuery $.ajax error response text?

Hi all, I am sending an error response to my jQuery. However I can not get the response text (in the example below this would be Gone to the beach) The only thing jQuery says is 'error'. See this example for details: php <? header('HTTP/1.1 500 Internal Server Error'); print "Gone to the beach" ?> jQuery $.ajax({ type: "post", da...

PHP Session help

HI , When I try to logout using the following code in IE it for some reasons just loops and loops and loops and wont stop. <?php $_SESSION = array(); session_destroy(); ?> <meta http-equiv="refresh" content="0;index.php"> Still getting some error's with this. It seems that in IE it keep refreshing every second if I change 0 to 2...

PHP session not storing data

HI , Say if I am viewing my page on computer 001 and I logout of the session and move onto computer 002 and log-in into the session for some reason I don't see my data it looks like its something to do with how I have done my sessions. does any one know why the data is not saving to the user ? And how I could fix it ? ...

how to get the local time in simple meridian format in php..

can u please help me out with the codes to get the present time n the meridian format..like its 1920 hours or 07.20 pm... how to make it independent of the location .. meaning... the users everywhere round the world shud get their local times.... ...

How to send messages from PHP application to Java application without creating webservices?

One possible solution could be simple HTTP get or post request, but that wouldn't be secure. ...

PHPmailer fails on live

Never ran into this problem before in all my years of web development, but oddly enough a site is acting up. We always use phpmailer to get the job done when sending emails, it is hooked into our backend package that we use to connect all our clients. All the clients are on the same server and everyone else is working except this site....

php - file download box

Hi, I'm giving a user a link to download a csv file ...just using Click <a href="report.csv">here</a> to download your file. This text and link is being displayed in a small popup window - height 100 width 400. If the user clicks "save" - then no problem then the file is saved to wherever they choose If though they choose "open" ...

PHP include file

i have two files:(localhost/template/) index.php template.php each time when i create an article(an article system is what i'm trying to do),i create a folder and then i copy the index.php in that folder. I want to include template php in index.php but as a static url('cause the articles will be like a folder-subfolder/subfolder/.. s...

Aggrivated unexpected T_ELSE in small PHP function

Hello, I have a very aggrivated unexped T_ELSE on the last else in this function. function QueryPeople($stringQuery, $table, $max, $cmd) { $con = mysqli_connect("localhost","user","password", "host"); if ($cmd == "Option1") { $SearchSQL = "SELECT signature, firstname, birthdate FROM $table WHERE lower(signature) LIKE ?...

Test if string is URL encoded in PHP

Hey guys, I've looked through the PHP Docs and can't see anything to do with this, so how can I test if a string is URL encoded? Is it better to search the string for characters which would be encoded, which aren't, and if any exist then its not encoded, or use something like this which I've made function is_urlEncoded($string){ $test...

Matching multiple occurrence of the same character with preg_match

how can i find multiple occurrence of the same character? something like: $maxRepeat = 3; "pool" passes "poool" don't i need this to work for any character, so i guess I'll have to escape special characters like . and \ which characters i have to escape? do you know any good reference to preg_match regexp apart from the one on php...