petroz
Members-
Posts
180 -
Joined
-
Last visited
Never
Everything posted by petroz
-
complete noob needs a guidance on very basic contact form
petroz replied to johnnyc82's topic in PHP Coding Help
It's getting past that... Your calling your died function at if(strlen($error_message) > 0) { died($error_message); You need to figure out what is actually causing the error. Note, your died function is asking for ($error) not ($error_message), I would make them match... -
First, check to see if imagick is install on your server with a php info. Once you get it installed its pretty simple. // Place file on server, into the images folder move_uploaded_file($_FILES['Filedata']['tmp_name'], "images/".$target); $im = new Imagick('$_FILES['Filedata']['tmp_name']); //open your file $im->thumbnailImage(150,150); //resize $im->writeImage($_FILES['Filedata']['tmp_name']); //write the thumbnail to the server
-
Reading SITE NAME and Transferring Data SITE NAME
petroz replied to TeddyKiller's topic in PHP Coding Help
I have had to do this before for a few sites... What I have done was split up dynamic and static content. Images, Videos on one server and HTML or Generated HTML on another server. Making the switch on a site really isnt too much work, its typically just a "Find and Replace" on stuff like "../images/" with "images.example.com/images/" Let me know if that helps. -
Reading SITE NAME and Transferring Data SITE NAME
petroz replied to TeddyKiller's topic in PHP Coding Help
First, you should ask why before how on this topic.. It is done because high traffic sights split up their content. If you dont have high traffic, I wouldnt even bother trying... -
import source file of name/value pairs to load an html table
petroz replied to DreCob619's topic in PHP Coding Help
In my book, your best bet is to throw your data into mysql. -
There's a couple ways todo this... I believe the standard would be using the PHP GD library, but I found Imagick to be very very easy to use. Here is an example I used before... //upload image $target = 'pics/'.$event.'/'; $target = $target . basename( $_FILES['uploaded']['name']) ; $ok=1; if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)){ echo "0"; } else { echo "1"; } //create thumbnail $im = new Imagick('pics/'.$event.'/'.$_FILES['uploaded']['name']); $im->thumbnailImage(150,150); $im->writeImage($dir.'/thumb_'.$_FILES['uploaded']['name']);
-
complete noob needs a guidance on very basic contact form
petroz replied to johnnyc82's topic in PHP Coding Help
I see a few culprits here... 1st **Block your code when posting please. 2nd You have telephone being change with the post of email subject... 3rd Your died function is being passed $error_message but its asking for $error $telephone = $_POST['telephone']; // not required $telephone = $_POST['email_subject']; // required Let me know if any of that helps -
Does it say a line number?
-
If you know the url, you could embed it on the link the users have to click, then grab that value on the popup through $_GET['url']; Like so <a href="example.com/popup?url=example.com" target="_blank">Share with Friend</a> and on your popup page, just grab the contents of the $_GET['url']; Let me know that helps.
-
There is no query for us to diagnose. Is there anything else on the elist.php file?
-
session_register is no longer used in php. You can set other values in your php session like so. $_SESSION['color']='red'
-
Executes database query when the page is loaded
petroz replied to emilcarlo's topic in PHP Coding Help
Great! -
Executes database query when the page is loaded
petroz replied to emilcarlo's topic in PHP Coding Help
You need to move the actual action that does the query into that if statement... Like so.. include("dbconnection.php"); $query = "SELECT * FROM records"; $result = array(); if(isset($_POST["btnSearch"])) { $query .= " WHERE last_name LIKE '%".$_POST["search"]."%' OR first_name LIKE '%".$_POST["search"]."%'OR territory LIKE '%".$_POST["search"]."%'OR job_title LIKE '%".$_POST["search"]."%'OR title LIKE '%".$_POST["search"]."%'OR employer LIKE '%".$_POST["search"]."%' " ; $result = mysql_query($query, $connection) or die(mysql_error()); } -
Executes database query when the page is loaded
petroz replied to emilcarlo's topic in PHP Coding Help
Since its a search engine, I am assuming you are using a form to submit the query... You could just put all the sql related stuff inside that if(isset($_POST["btnSearch"])) Let me know if thats clear enough. -
PHP && GET method.. using special character &
petroz replied to newyear498's topic in PHP Coding Help
You can encode it before you pass it... $data = http://example.com/?foo=bar&bar=foo urlencode($data); -
Looking for more info on "Page Caching" solution using files
petroz replied to xtian's topic in Frameworks
Are you using a framework? -
I highly recommend learning a framework.. I like you wrote a fair handfull of php/mysql applications by hand. I was interested in getting things done faster as there seems to be less and less time everyday! I like you started with a few codeigniter tut's and found em to be great, but just got stuck on crud for a while, but that was only a short while... After fiddling around for a few days I found myself coding however I fealt like in CI, I didnt have to use their libraries and helpers at all... But nearly everytime I went to write a function to do something I always looked a the user guide and found their solutions much easier to implement... CI will allow to code comfortably without having to relearn everything, but it also will give you plenty to work with. I highly recommend giving it a serious shot for a week or so. Thanks, Peter
-
There is honestly a few way's todo this. CI Has a great form validation tool that has a function called set_value which allows you to present the previously typed data into it, but thats not the only way... One thing I find myself doing all the time is storing the user input as a array on the controller, and since I like to reuse my views, I simply tell the controller to pass any post data to that array and pass that array to the view. Then, the view will always look to see if the array has data in it for the specific field, if its there... put the contents into the value section... It's actually rather simple once you do it a few times... Here's an example. MyController.php <?php class Welcome extends Controller { function Welcome() { parent::Controller(); } function index() { if($_SERVER['REQUEST_METHOD'] == "POST"){ //get the form data $data['search_keyword'] = array( "field1" => $this->input->post('field1'), "field2" => $this->input->post('field2') ); //load the database model $this->load->model('my_model'); //pass the data to the database $data['results'] = $this->my_model->search($data['search_keywords']); //load the view with the results and form data $this->load->view('search', $data); } else { $this->load->view('search'); } } } Then my view <html> <head> <title>My View</title> </head> <body> <form method="post" action="MyController/form"> <input type="text" name="field1" value="<?php if(!empty($search_keyword['field1'])){ echo $search_keyword['field1'];?>"> <input type="text" name="field2" value="<?php if(!empty($search_keyword['field2'])){ echo $search_keyword['field2'];?>"> </form> </body> </html> Now I havent tested this stuff, but its basically what I do most of the time I am trying to accomplish what you are doing. Even though this all works fine, CI has some great libraries for forms and validation and databases and I highly recommend spending the time looking into to leveraging those over just plain old php and html. Let me know if that helps! Thanks, Peter
-
Wordpress Permalinks - getting info from the url to a page
petroz replied to jarvis's topic in Applications
That doesnt seem to be in the supported permalink tags... http://codex.wordpress.org/Using_Permalinks -
Member Comment Database Structure help please :D
petroz replied to JonnySnip3r's topic in Applications
Just start playing with it. It looks like your headed in the right direction. Although, things will prob change slightly as you go. -
How to allow novice users to add data to my websites php files???
petroz replied to evBenji's topic in Applications
Integrate mysql and a few forms and you can have complete control. -
If you know what your doing, you can get their site template, chop it up... slap it into your framework of choice (I use CodeIgniter) and start building away...
-
I like either google charts or fusion charts.
-
look no further than google.... http://codex.wordpress.org/Theme_Development
-
force 'https' with .htaccess and codeigniter on godaddy
petroz replied to boo_lolly's topic in Frameworks
Show us your httaccess file.