paulkd 59 Newbie Poster

You might need a css reset.

paulkd 59 Newbie Poster

To get you started...

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Test</title>
</head>
<body>
<form id="js-tracker-form" name="tracker" action="/tracker" method="POST">
    <p><input type="checkbox" name="check1" value="1"> <input type="text" name="check1date" value=""></p>
    <p><input type="checkbox" name="check2" value="1"> <input type="text" name="check2date" value=""></p>
    <p><input type="checkbox" name="check3" value="1"> <input type="text" name="check3date" value=""></p>
    <p><input type="submit" name="submit" value="Submit"></p>
</form>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
    var today = new Date();
    $("#js-tracker-form").on("click","input[type=checkbox]",function(){
        if($(this).prop("checked")) {
            //the actual checking of the element beats this event handler
            $(this).next().val(today.toDateString());
        } else {
            $(this).next().val('');
        }
    });
</script>
</body>
</html>

JavaScript Date

paulkd 59 Newbie Poster

Juust noticed in my previous post - it should just be die();

Don't put "put" :D

paulkd 59 Newbie Poster

I use jQuery (a JavaScript library). Can you provide the FORM code ?

paulkd 59 Newbie Poster

This is done using JavaScript not PHP. It is "client-side" scripting/programming.

paulkd 59 Newbie Poster
  1. There are many evolving technology areas. It is difficult to decide where your focus efforts. JavaScript is a key web technology. Don't start with jQuery (or similar libraries), learn raw JavaScript first.

  2. APIs - weather, maps, paypal, amazon, stripe. Google "public apis"

best4earn commented: THANKS PAULKD +2
paulkd 59 Newbie Poster

Your "Buy Amazon" image link appears to be in tact, the additional text link after appears to be the one missing the affiliate code, if tag=romautjudrai-20 is your affiliate code.

What happens if you put die(); after the line beginning echo JHtml::link
?

I did a Google search on "joomla 3 links not working" and quite a few hits came up, they could be dead ends, but I'm not familiar with Joomla.

paulkd 59 Newbie Poster

What are you trying to achieve?
I can understand reloading a page every x seconds, but why would you display a page and then x seconds later reload the page just once?

paulkd 59 Newbie Poster

Is the site available for us to view?

paulkd 59 Newbie Poster

I've not tested this but I don't think you need to iterate your selectors to add the keyup event handler. You should be able to use the following code:-

$(".txtt").keyup(function() {
    calculateSum();
});
paulkd 59 Newbie Poster

Did you append the ?filepage=image25.jpg to your checkfile.php ?

paulkd 59 Newbie Poster

Remove the two includes.

I notice the code you have displayed is using $_GET['filepage'] instead of my $_GET['filename'].
This is not an issue, as obviously you called
www.website.com/ajax/check-file.php?filepage=image25.jpg

After removing the includes, please rerun and copy/paste here the actual error that is displayed.

paulkd 59 Newbie Poster

have you run it as I described?

paulkd 59 Newbie Poster

davy_yg,

Your HTML document is lacking structure. I think you should spend time looking at HTML primers. You page doesn't have a single paragraph tag.

Your webserver doesn't appear to be set up correctly. Your PHP code is not being interpreted.

paulkd 59 Newbie Poster

Thanks for posting your code, it gives me a better view of your setup.

We'll take it one step at a time. First you need to create a php file that will check for the existence of a specified file in your assets/files folder.

Here is the php code. Place it where you want and test that it works.
I like to have an ajax folder - e.g.
www.website.com/ajax/check-file.php?filename=image25.jpg

<?php 
echo  file_exists($_SERVER['DOCUMENT_ROOT'].'/assets/files/'.$_GET['filename']) ? json_encode(array(1)) : json_encode(array(0));
?>
paulkd 59 Newbie Poster

Can you show the whole page?

paulkd 59 Newbie Poster

There are so many ways to play with this. I've used an array to complement the table structure and seeded the array with either text (to display) or 1 (which currently displays a hyphen and if not set increment a counter.

<?php
$rows = 14;
$columns = 5;

$ins = array(
    0 => array(
        0 => 'Driver\'s Seat',
        1 => 1,
        2 => 1,
        3 => 1,
        4 => 1
    )
);
for($i = 1; $i<13; $i++) {
    $ins[$i][2] = 1;
}

$count = 1;
?>

<table border>
<?php for($row = 0; $row<$rows; $row++): ?>
<tr>
    <?php for($col = 0; $col<$columns; $col++): ?>
    <td>
    <?php 
        if(array_key_exists($row,$ins) AND array_key_exists($col,$ins[$row])) {
            if(is_numeric($ins[$row][$col])) {
                echo '-';
            } else {
                echo $ins[$row][$col];
            }
        } else {
            echo $count;
            $count++;
        }
    ?>
    </td>
    <?php endfor; ?>
</tr>
<?php endfor; ?>
</table>

You can add css etc. yourself (you may need to move the TD inside the php block to add appropriate classes).

paulkd 59 Newbie Poster
//simulate posted field
$_POST['formfield']='Is #star contained in your #database of #hashtags?';

preg_match_all('/#\w+/',$_POST['formfield'],$matches);

if($matches[0]) {
    foreach($matches[0] as $hashtag) {
        $sql = "select hashtag from `hashtag-table` where hashtag = '".substr($hashtag,1)."'";
        $result = mysql_query($sql);
        echo mysql_num_rows($result) ? $hashtag.' found<br>' : $hashtag.' not found<br>';
    }
}

Sorry everyone it's mysql - been using CI query builder recently so haven't gotten around to the mysqli syntax, or even PDO.

paulkd 59 Newbie Poster

and are the hashtags in your database in a single column?

e.g. hashtags varchar(200) NOT NULL

so the sql would be something like:-

select count(hashtag) from hashtags where hashtag = $thisHashTag

paulkd 59 Newbie Poster

Is there more than one field in the form?

paulkd 59 Newbie Poster

In .htaccess

Options All -Indexes

will turn directory browsing off

More on htaccess

paulkd 59 Newbie Poster

You could write a function for your value testing:-

<?
function selected($expr)
{
    return $expr ? ' selected="selected"' : '';
}
?>

<label>Time Zone:</label><select name="timezone">
<?
$timezns = timezone_identifiers_list();
foreach ($timezns as $timezn) {
    echo '<option value="'.$timezn.'"'.selected($timezn == $row['timezn']).'>'.$timezn.'</option>';
}
?>
</select>
paulkd 59 Newbie Poster

How do you know which is my timezone?

paulkd 59 Newbie Poster

Hi Sabarinadh,

Did you copy and paste?
Is the error pointing to the line which I supplied?

I have tested it here and all is well.

paulkd 59 Newbie Poster

echo '<li><a style="text-decoration :none" href="playerslist.php?id='.$rows['id'].'">'.substr($rows['name'],0,50).'</a></li>';

paulkd 59 Newbie Poster

Also,

Have you looked at the configurations for CI email?

Do you have an email server? either from you host or installed on localhost?

paulkd 59 Newbie Poster

A quick question davyg. What is the web address to your contact form.

e.g. www.mywebsite.com/contactus ?

paulkd 59 Newbie Poster

select tax+rate as total from table

paulkd 59 Newbie Poster

I would increment 1,2,3 and preprend 000000.
If your two columns are numerically in sync, as auto-increment would suggest, then you could use a formula and not have a ref column.

paulkd 59 Newbie Poster
$(document).ready(function() {    
    clearTextBox();
});

function clearTextBox() 
{
    $('#txtName').val = "";
    $('#txtContactEmail').val = "";
    $('#txtMessage').val = "";
}

$('#btnReset').on("click",function() {
    clearTextBox();
})
paulkd 59 Newbie Poster

If you don't need the trim (you know that the txt file records are already trimmed) you could simply use an array function.

$ip_needle = $_SERVER['REMOTE_ADDR'];
$ip_haystack = file('/ip.txt',FILE_IGNORE_NEW_LINES);
echo in_array($ip_needle,$ip_haystack) ? $ip_needle.' found' : $ip_needle.' not found';
paulkd 59 Newbie Poster

where is your <form action=""> in contactus.php ?

paulkd 59 Newbie Poster

JavaScript code would be best.

paulkd 59 Newbie Poster

There's no form in contactus.php

paulkd 59 Newbie Poster

So I think you are left with using window.open. Is this allowed?

paulkd 59 Newbie Poster

But I would be wrong :(

paulkd 59 Newbie Poster

I think you might just be able to add

$(".article-content").find("a.news-title").attr("target","_blank");

to your js file.

paulkd 59 Newbie Poster

Controller. A view is just for displaying a web page, or partials.

paulkd 59 Newbie Poster

If you apply a style of display:inline-block, set the width and add a margin-right or margin-left to the hyperlink tags this should do it.

paulkd 59 Newbie Poster

IF you are emailing the contents of a form. In your form handler:-

$this->load->library('email');

$this->email->from('your@example.com', 'Your Name');
$this->email->to('someone@example.com'); 
$this->email->cc('another@another-example.com'); 
$this->email->bcc('them@their-example.com'); 

$this->email->subject($yourFormSubject);
$this->email->message($concatOfFormFieldsYouWantToSend);    

$this->email->send();
paulkd 59 Newbie Poster

Hopefully this will help you progress. Your City_date in $ar and City_Date in your database are case-mismatched.

$sql = "SELECT * FROM bills WHERE Active = 'Y' and City_total <> '' ORDER by xyear desc , xmonth desc  limit 0,1";

$result = mysql_query($sql) or die(mysql_error());


$arr = array(
    Array ( "City", 12, 29,"Y", "City_Date", "City_Total" ),
    Array ( "Atmos", 8, 23, "Y", "Atmos_date", "Atmos_Total" )
 );


while($row = mysql_fetch_assoc($result)) {

    foreach($arr as $key => $ar) {
        echo $row[$ar[4]].'<br>';
    }
    exit();
}
paulkd 59 Newbie Poster

Sorry this is taking a while.

So for "Sprint" would your $ar array be something like:-

Array ( "Sprint", 12, 29,"Y", "Sprint_date", "Sprint_Amount" ) ?

paulkd 59 Newbie Poster

Instead of deleting all the records you can truncate the table. This should reset the auto increment.

paulkd 59 Newbie Poster

forgot the ajax file:- /ajax/check-file.php. Obviously where you store files is up to you.

<?php 
echo  file_exists($_SERVER['DOCUMENT_ROOT'].'/assets/images/'.$_GET['filename']) ? json_encode(array(1)) : json_encode(array(0));
?>
paulkd 59 Newbie Poster

I've added an id="upload-form" to your <form> tag.

upload-check.js

$("#upload-form").on("submit",function(){
    var filename = $("#upfile").val();
    if(filename=="") {
        alert("Please select a file");
        return false;
    } else {
        if ($("#upfile").data("exists")==1) {
            return confirm(filename+" already exists. OVERWRITE?");
        }
    }
});

$("#upfile").on("change",function(){
    checkExists($(this).val());
});

function checkExists(filename)
{
    var result;
    var request = $.ajax({
        type: "GET",
        url: '/ajax/check-file.php',
        dataType: "json",
        data: {filename: filename}
    })

    request.fail(function(jqXHR, textStatus){
        alert( "ajax request failed: " + textStatus );
    });

    request.done(function(data) {
        $("#upfile").data("exists",data);
    });

}
paulkd 59 Newbie Poster

You need an ajax call that will perform a php file_exists and return json true or false.

Your form should be prevented from being submitted via the submit button (and users pressing enter in one of the input fields).

The submit button should run the ajax and display the overwrite prompt if the ajax call returns true.

The form can be submitted using JavaScript.

paulkd 59 Newbie Poster

..and is your script running off www.url.ro/underpublic/searchforprice.php ?

paulkd 59 Newbie Poster

Sorry for repeating your reply EvolutionFallen. Fingers working faster than brain/eyes. ;-)

paulkd 59 Newbie Poster

I haven't checked your code, but there's no need to use $location

if (in_array($search_zip, $loc1))  { 
    header("Location: http://dr.gorillaadvertising.net/no-service-in-your-area/"); die;
} else { 
    header("Location: http://dr.gorillaadvertising.net/order-dry-cleaning/"); die;
}
paulkd 59 Newbie Poster

More explicitly www.yourwebsite.com/underpublic/searchforprice.php

What happens if you take the crossDomain: true line out?