-
Posts
3,404 -
Joined
-
Last visited
-
Days Won
55
Everything posted by Ch0cu3r
-
For file uploads to work you need to add the enctype="multipart/form-data" attribute to your <form> tag. <form action="uploader.php" method="post" enctype="multipart/form-data"> <p>File Upload<p> <p>Select file <input name="cv" type="file" size="50" /></p> <input type="submit" value="Upload" />
-
You'll need to see if the forum has an api to allow you to integrate the forums login with your sites login. You then use the api for registering and logging in users to you site. Heres an API for IPBoard http://www.invisionpower.com/support/guides/_/advanced-and-developers/integration/single-sign-on-sso-r209 xenforo has a few mods for various forms of integration. http://xenforo.com/community/resources/categories/bridges-integrations.17/
-
You could use regex. $text = '@red: #e51400; @blue: #0076a3;'; preg_match_all('~@(\w+:\s+#[a-f0-9]+);~', $text, $matches); foreach($matches[1] as $match) { list($var, $value) = explode(':', $match); $$var = trim($value); } echo "Red: $red<br /> Blue: $blue";
-
Don't understand way my jquery script will not work
Ch0cu3r replied to rdkurth's topic in Javascript Help
I got it to work using .html() instead of .text() $("#responsetext").html(response); Also setup your select tag as <select name="customer" id="responsetext"> </select> -
Best way to check if one array values less than another array?
Ch0cu3r replied to RuleBritannia's topic in PHP Coding Help
Could try array_diff_assoc $array1 = array( 'width' => 400, 'height' => 300, 'start' => 200, 'end' => 100 ); $array2 = array( 'width' => 400, 'height' => 30, 'start' => 20, 'end' => 10 ); $diff = array_diff_assoc($array2, $array1); printf('Values that are lower in $array2 are: <pre>%s</pre>', print_r($diff, true)); -
Can't get mod_rewrite url to work correctly
Ch0cu3r replied to Jason28's topic in Apache HTTP Server
Try this rule RewriteRule ^area-([0-9]+)/[^/]+/category-([0-9]+)/ test.php?id=$1&cat_id=$2 [L] Then don't wrap parentheses around regex that you dont want to reference later on. Not relevant -
Don't understand way my jquery script will not work
Ch0cu3r replied to rdkurth's topic in Javascript Help
Because you have invalid html code, you've opened two divs but only closed one and you have wrapped the responsetext div around the closing select tag (</select>). Only <option> tags should be within a <select> tag. To make it easier I would apply the responsetext id to the select tag. <select name="customer" id="responsetext"> </select> It works when you comment out the select tags because the browser tries to fix the invalid html code (quirks mode). -
Registration and Upload not working
Ch0cu3r replied to IlaminiAyebatonyeDagogo's topic in PHP Coding Help
What do you mean by this? Have you made the changes suggested by davidannis and scootstah above? -
Well you need to change topsite to debtor (your database table name). Next you need to apply the pagination code to your query not the tutorial's queries. The tutorial has left comments in the code telling you what you need to do.
-
Change <td><span class="title"><? echo $this->pagetitle;?></span></td> to <td><img src="url/to/site/logo.jpg" alt="<? echo $this->pagetitle;?>" /></td> to apply the site logo.
-
field3 contains an empty object, which you're trying to convert to a string. PHP cannot convert an object to a string unless you define a __toString method, but that is out of your control as the api is defining the serialized object. If all need is field1 and field20 value then don't use a loop just do $product = $result->products->product; echo $product->field1; echo $product->field20; If you want to write these values to your var_dump.txt file then use $product = $result->products->product; $txt = "field1 = {$product->field1} field20 = {$product->field20}"; file_put_contents( '/vardump.txt' , $txt, FILE_APPEND );
-
What I meant was post the code for this method (from the pagebuilder class). function showHeader($pagetitle = '') {
-
Never used var_export. Used to the output from print_r try using foreach ($result->products->product as $field => $value) { echo $field . ' = ' . $value . '<br />'; } If you want to get each fields value manually you'd use $product = $result->products->product; echo $product->field1; //... etc ... echo $product->field20;
-
Post the code for the showHeader method this is code you'll probably need to modify.
-
What api are you using as the serialized array structure you posted does not seem to be in php format. What does this return printf('<pre>%s</pre>', print_r($result, true));
-
I said that wrong. -204.1 is lower than -204. So the nearest whole number is -205
-
Then you need to use ceil for negative numbers $part = trim($part, " <>"); $part = ($part > 0) ? floor($part) : ceil($part); floor rounds numbers down. -205 is lower than -204.1
-
really curious how to store or retrive images
Ch0cu3r replied to desjardins2010's topic in PHP Coding Help
When the image is uploaded you save the images path to the database. When you want to display the image you echo the images path into the <img> tag eg echo '<img src="' . $row['image_path']; '" />'; -
You get the selected checkbox values from the $_POST['element_0'] array. Example code to see what was selected. echo ' You have selected: ' . implode(', ', $_POST['element_0']);
-
Define your array then serialise it using $.param. <script> $(function() { $("#btn_test").click(function(){ // key : value values = { "test_type": "any old type", "test_mode": "any mode" } $.post("sessions_set.php", $.param(values)); }); </script> In your PHP code you'd use a loop to define the $_SESSION vars foreach($_GET as $key => $value) { $_SESSION[$key] = $value; }
-
You need to echo the variables so their values are outputted into the javascript <?php if($username && $userid) : ?> var theName = "<?php echo $username; ?>"; var theMail = "<?php echo $email; ?>"; <?php endif; ?>
-
My code is not a copy and paste solution only a guide. I do not know how your shopping cart works so I cannot tell you where and what you need to change.
-
Failing to replicate BASIC INT() division as PHP code
Ch0cu3r replied to Witblitz's topic in PHP Coding Help
Its actually 35.24 but the int rounds it down to nearest integer. Are you sure that these are the same values from the original code on the older computer? -
The first foreach loops through each post array within $posts. The second foreach loops over the elements (body, stamp, post_id, user_id) in the post.
-
Best way to search result with ARRAY of needles?
Ch0cu3r replied to RuleBritannia's topic in PHP Coding Help
You just answered your question.