FlashCreations 20 Posting Whiz

Alright just a few minor problems:

function ajaxGetInfo(title)
{
	a = ajax();
	if(a!=null)
	{
		a.onreadystatechange = function() { if(a.readyState == 4) document.getElementById('info').value = a.responseText; }
		a.open("GET", "includes/getDescription.php?title="+title, true);
		a.send(null);
	}
	else document.getElementById('info').value = "Error retrieving data!";
}
 
function ajax()
{
	if(window.XMLHttpRequest) return new XMLHttpRequest();
	if(window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
	return null;
}

index2.php

<?php
session_start();
// Checks if the user isn't registered in session
if (!isset($_SESSION['user'])) echo header("Location: login.php");
?>
<!doctype html>
<html>
	<head>
<?php
require_once("includes/connection.php");
require_once("includes/functions.php");
include("includes/header.php");
?>
	</head>
    <body>
<?php
include("includes/nav.php"); 
include("includes/upper_content.php"); 
include("includes/getDescription.php"); 
?>
<div id="main_body">
<table width="936" align="center" cellpadding="10">
	<tr>
		<td align="center">
			<p align="center">Enter your addition to one of the books in the drop-down list. There is no length limit.</p>
      		<hr />
      		<table>
            	<tr>
                	<td align="center">
      					<form method="post" action="submit_contribution.php">
        					<fieldset>
          						<legend>Select a Book:</legend><br />
          						<?php $result = mysql_query("SELECT id, book_name FROM iin_books"); ?>
		  						<select name="category" onchange="ajaxGetInfo(this.value)">
		  							<option>Select a book title...</option>
		  							<?php if(mysql_num_rows($result)!=0): ?>
                                    <?php while($nt=mysql_fetch_array($result)): ?>
			  						<option value="<?=$nt['sub_cat_id']?>"><?=$nt['book_name']?></option>";
                                    <?php endwhile;
										  endif; ?>
			  					</select>
          						<p>Contribution:<br /> <textarea name="contribution" id="contribution" cols="50" rows="10"></textarea></p>
          						<p style="color:#F00; font-family:'Lucida Sans Unicode', 'Lucida Grande', sans-serif; font-size:12px;">
            						<input type="checkbox" /> I accept <a href="tou.php" style="color: #09F;">Terms of Use</a> and <a href="privacy.php" style="color:#09F;">Privacy Policy</a>.
								</p>
          						<p><input type="submit" value="   Submit Your Contribution   " /></p>
        					</fieldset>
                        </form>
        			</td>
        			<td valign="top">
      					<p>Book Description</p>
      					<textarea name="info" id="info" cols="20" rows="5" readonly></textarea>
      				</td>
				</tr>
      		</table>
      		<br />
      		<br />
      		<a href="logout.php">Logout</a>
		</td>
	</tr>
</table>
</div>
<?php include("includes/footer.php"); ?>
</body>
</html>

Table styling...*cringe!*

getDescription.php:

<?php 
require_once("includes/connection.php");
require_once("includes/functions.php");

function return_description($title) 
{
	//On the below line, replace * with the name of the row that …
FlashCreations 20 Posting Whiz

Nope you need AJAX (JavaScript to do this). PHP is server side. Javascript is clientside. Serverside code is long completed when you see the final output. There would be no way to perform a query without calling a script on the server with AJAX. Sorry to disappoint. But if you do want to try AJAX:

<html>
 <head>
  <title>Daniweb Ajax Demo</title>
  <script type="type/javascript">
  function ajaxGetInfo(title)
  {
   a = ajax();
   if(a!=null)
   {
    a.onreadystatechange = function { if(a.readyState == 4) document.getElementById('info').value = a.responseText; }
    a.open("GET", "getInfo.php?title="+title, true);
    a.send(null);
   }
   else document.getElementById('info').value = "Error retrieving data!";
  }
  function ajax()
  {
   if(window.XMLHttpRequest) return new XMLHttpRequest();
   if(window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
   return null;
  }
  </script>
 </head>
 <body>
  <select name="books" onchange="ajaxGetInfo(this.value)"></select>
  <textarea name="info" id="info" cols="20" rows="5"></textarea>
 </body>
</html>

Then just write a php script called getInfo.php that accepts the title as a GET argument and echoes back the information.

FlashCreations 20 Posting Whiz

So you want to reply to send back to AJAX the exact content that AJAX sent through post? That seems kind of pointless to me, unless you want to do something to the data first (like search for it in a DB). In that case do this:

demo_insert.php:

//Use the POST value you sent up with $_POST['content']
//Send data back to JQuery with echo
echo "Hello JQuery!";
FlashCreations 20 Posting Whiz

Inside a complex syntax brackets ( {$var} ) you can call any function with a return value that can be converted to casted to a string. So using your code that would be:

$message .= "<td>XXXX-XXXX-XXXX-{substr($_GET['cc_number'] , -4, 4)}</td>";

//Or this....
$message .= "<td>XXXX-XXXX-XXXX-".substr($_GET['cc_number'] , -4, 4)."</td>";

//Or even this...
$message .= "<td>XXXX-XXXX-XXXX-";
$message .= substr($_GET['cc_number'] , -4, 4);
$message .= "</td>";

The first or second ones make most sense to me, so I would chose one of them, but it's totally up to you!

drewpark88 commented: Helped me alot! +1
FlashCreations 20 Posting Whiz

What you are looking for is file writing/reading operations. For this you use fopen along with the w parameter which tells PHP you want to write to the file (and create it if it doesn't already exist).

$name = $_GET['name']; //Or where-ever you get the file name
//Sanatize
$name = str_replace('\\', '', $name);
$name = str_replace('/', '', $name);

//Open the file
$f = fopen('safedir/'.$name.'.php' , 'w');
//Write to the file
fwrite($f, "Hello World! Your code or HTML should go here.");
//Close file
fclose($f);

//Next, redirect to the new file
header("Location: safedir/{$name}.php");
FlashCreations 20 Posting Whiz

My code and yours, regarding the date, are exactly the same (Except for the $now = time(); which is unnecessary). To suppress the errors, you can use:

error_reporting(0);

How about try:

if((int)date('Ymd') === (int)date('Ymd', $this->airdate)) $dateFormat = 'g:ia';
elseif((int)date('Y') === (int)date('Y', $this->airdate)) $dateFormat = 'F jS - g:ia';
else $dateFormat = 'F jS, Y - g:ia';
FlashCreations 20 Posting Whiz

Are you sure you have the correct login credentials. It seems that your password for the root user is not valid.

FlashCreations 20 Posting Whiz

There! Simple fix! (Try the download again!) The code should be integrated with your database and should request the program info from MySQL just like you did in your first post.

I'm sure you know by now, but just for convenience: http://files.phpmycoder.net/0110dac/

FlashCreations 20 Posting Whiz

Today's just not a good day for me! The reason you are getting the same errors is because the file on my site wasn't updated. I've tried to upload it several times and for some reason my script is serving an older version. I'll try to upload it again. Sorry for all of these problems!

FlashCreations 20 Posting Whiz

Fixed! This version should be integrated with the code you already provided (That retrieved the results from the DB) and hopefully will work on your server! If you have any questions about the script you can post back here, PM me, or refer to the README file included in the ZIP folder.
http://files.phpmycoder.net/0110dac/

FlashCreations 20 Posting Whiz

Oh so I see you have found that I fixed the problem! And that line your are referencing is a test line that I used in debug that for some reason came back (My fixes might have altered the file a few times). Let me fix the file (one last time! hopefully) and post back when it's done!

FlashCreations 20 Posting Whiz

Oh alright...my bad. And I also hope that they will be fixed soon (or rather, I hope I can fix them quicker)!

FlashCreations 20 Posting Whiz

We know! Sorry for the delay and the problems with my website (As I said, my host has changed the directories around and I can't figure out exactly what they did. I'm submitting a support ticket to them and since their support is excellent I should have a reply in a little less than a day!). In the mean time though, maybe we can arrange something through PM. I can email you the file, if you wish...

FlashCreations 20 Posting Whiz

And your absolutely right! I should have just grabbed a Creative Common License, but I didn't (I'm not sure why...). I am planning to do this though. When I complete the update to my site, I will begin to include scripts (like the pagination one) for the use of others. Until then, I don't really have a plan, but hopefully I'll finish my updated site soon!

FlashCreations 20 Posting Whiz

So then instead of worrying about JavaScript support, you can simply rely on the solution that will work regardless of whether the user has JavaScript enabled:

<?php
error_reporting(E_ALL); //So you can find any errors (If you don't have them enabled)
mysql_connect(" ", "", "") or die(mysql_error()); //Replace with login credentials
mysql_select_db("TACusers") or die(mysql_error());
$result = mysql_query("SELECT Site, SiteNumber, URL, Description, Type, Rating FROM UserSites WHERE Username='".mysql_real_escape_string($username)."' ORDER by Site");

if(!isset($cmd))
{
	//Print all of the users sites
	while($row = mysql_fetch_assoc($result))
	{
		echo '			<a href="'.$row["URL"].'">'.$row["Site"].'</a> '.
			 '			'.$row['Type'].' '.
			 '			'.$row['Description'].' '.
			 '			<img src="'.$row['Rating'].'" alt="'.$row['Description'].'" /> '.
			 '				<form action="'.$_SERVER['PHP_SELF'].'" method="post">'."\n".
			 '					<input type="hidden" name="SiteNumber" value="'.$row["SiteNumber"].'">'."\n";
			 '					<input type="submit" name="submit" value="Delete">'."\n".
			 '				</form><br>'."\n";
	}
}

if(isset($_POST['submit']) && $_POST['submit']=="Delete")
{
	mysql_query("DELETE FROM UserSites WHERE SiteNumber=".mysql_real_escape_string($_POST['SiteNumber']));
	echo '<strong>Site Deleted!</strong><br>'."\n";
	echo '<a href="'.$_SERVER['PHP_SELF'].'">Go Back</a>'."\n";
}
?>

And so the form displays correctly, add this CSS to your page:

form { display: inline; }
FlashCreations 20 Posting Whiz

And by your opinion that's wrong? Site Usability 101 says "Don't use JavaScript when it's not necessary." As I said before, using multiple forms., hidden text fields (for the Site Number), and submit buttons to send the form (delete the site).

FlashCreations 20 Posting Whiz

As long as credit is given, it is perfectly fine with me! Right now, I'm looking into the downloading problem. It should be fixed soon...

FlashCreations 20 Posting Whiz

Looks like my hosting company has changed some stuff around without me noticing! Sorry about this inconvenience. I can't figure it out right now, but I'll get to it as soon as possible. Hopefully it's an easy fix on my side!

FlashCreations 20 Posting Whiz

Here is a very simple example to dynamically change forms "action" using javascript. Let's assume we have 4 rows, like in your app, so i created 4 buttons.
Every button when clicked, first will change the forms "action" field, the submits it.
I think that tuning this example into your app wouldn't take much time...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>

<head>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
	<meta name="author" content="mazuki" />

	<title>Untitled 3</title>
</head>

<script type="text/javascript">
var changeId = function(id)
{
	document.f1.action += '?id=' + id; 
}
</script>

<body>

<?php

if($_SERVER['REQUEST_METHOD'] == 'POST')
{
	if(isset($_GET['id']))
	{
		$r = (int)$_GET['id'];
		echo 'Row to delete: '. $r;
	}
}

?>

<form name="f1" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="submit" value="Delete" onclick="changeId(1)" /><br />
<input type="submit" value="Delete" onclick="changeId(2)" /><br />
<input type="submit" value="Delete" onclick="changeId(3)" /><br />
<input type="submit" value="Delete" onclick="changeId(4)" />
</form>

</body>
</html>

But why? Some users (me included) have JavaScript disabled by default. Using it for a key function might not be the best idea. And like I said, the code should work. It should delete. The only thing I can think would be that the your MySQL is incorrect. What does the table look like that your are deleting the row from...

Also, just wondering: It sounds like you've made a couple changes to the code (beyond what we have suggested)...can you copy and paste the exact code that you are running?

FlashCreations 20 Posting Whiz

Always try to use HTML action button to submit your page if you do not have any javascript checks.

Exactly! Why use javascript when you can simply use a submit button that does the same job!

FlashCreations 20 Posting Whiz

This means that i should write my header line something like this :

<?php
session_start();
require("afterlogout.php");
require("globals.php");

		 	    if(isset($_POST['Ok']))
				{
 				$description = $_POST['description'];
 $query = "INSERT into tblexpenselocation (Description) VALUES ('$description');";
 		 $result = mysql_query($query) or die(mysql_error());
				 header( 'Location: expenselocation.php') ;
				 }
			    ?>

Would it solve the problem with refresh?

Yes, that's where you should put it! But sadly, no it won't fix your session problem. It will just prevent an error message from showing up when you try to redirect to that page.

FlashCreations 20 Posting Whiz

Just so you know, you cannot add headers after the first character (outside the PHP tags) has been written. Also, a few of your CSS properties will throw up some errors. I also noticed that you use javascript to submit your form. This doesn't seem necessary (You can set the form action with the action attribute and a input element of type submit will submit the form by default.

FlashCreations 20 Posting Whiz

Every 15 seconds? That's a really short interval! It seems like this would add a constant load on the server (therefore taking processing power away from user requests). I suggest you stick to a bit longer of an interval, maybe 10 minutes?

But to create a loop with a delay...

$counter = 0;
while(true)
{
  if($counter==100) break;
  $counter++;
  sleep(20); //Wait 20 seconds
}
FlashCreations 20 Posting Whiz

When you changed it from hidden.....did you not read my post? That is a text field that contains the site number. When you click the delete button, PHP gets the site number and deletes that site from the DB. The input field with the type hidden is not the button! The input that is the submit is the one with the type of submit!

Try widening your table if you can't see the submit button. It's definitely there!

FlashCreations 20 Posting Whiz

Alright, it's all integrated for you http://files.phpmycoder.net/0110dac/!

FlashCreations 20 Posting Whiz

The hidden field is an invisible text field. It needs to remain hidden.

<form action="index.php" method="get">
<input type="hidden" name="iam" value="something">
<input type="submit" name="submit" value="See it!">
</form>

If you were to submit the following form, the url would be index.html?iam=something&submit=See It! (<--- The exclamation mark would be URL encoded, but I don't know the code for it). When you view the page though, all you would see is a submit button.

FlashCreations 20 Posting Whiz

One thing at a time...Sure I'd be glad to integrate my pagination class into your code. Give me a few days though, I've jammed two of my fingers and its not too pleasant to type with swollen fingers!
What do you mean: get a script to include a file from the database? The page I see is some TV program guide. Are you trying to include one PHP file in another. If so, try this:

include "file2.php";
FlashCreations 20 Posting Whiz
'<input type="submit" name="submit" value="Delete">'."\n".

I wonder what this is then...

FlashCreations 20 Posting Whiz

Well here you go. I tried to fix a few things and make it a little neater. It pains me to use tables!! Why! That's as bad as forcing me to watch a Yankees game (I'm a Sox fan, obviously...)

<?php
mysql_connect(" ", "", "") or die(mysql_error());
mysql_select_db("TACusers") or die(mysql_error());
$result = mysql_query("SELECT Site, SiteNumber, URL, Description, Type, Rating FROM UserSites WHERE Username='".mysql_real_escape_string($username)."' ORDER by Site");

echo '<table>'."\n".
	 '<tr>'."\n";
if(!isset($cmd))
{
	//Init the row count variable
	$row_count = 0;
	//Print all of the users sites
	while($row = mysql_fetch_assoc($result))
	{
		if ($row_count == 3) 
		{
			echo '</tr>'."\n".'<tr>'."\n";
			$row_count = 0;
		}
		echo '<td>'."\n".
			 '	<table>'."\n".
			 '		<tr bgcolor="gainsboro">'."\n".
			 '			<td>'.$row['SiteNumber'].'</td>'."\n".
			 '			<td><a href="'.$row["URL"].'">'.$row["Site"].'</a></td>'."\n".
			 '			<td>'.$row['Type'].'</td>'."\n".
			 '			<td>'.$row['Description'].'</td>'."\n".
			 '			<td><img src="'.$row['Rating'].'" alt="'.$row['Description'].'" /></td>'."\n".
			 '			<td>'."\n".
			 '				<form action="'.$_SERVER['PHP_SELF'].'" method="post">'."\n".
			 '					<input type="hidden" name="SiteNumber" value="'.$row["SiteNumber"].'">'."\n";
			 '					<input type="submit" name="submit" value="Delete">'."\n".
			 '				</form>'."\n".
			 '			</td>'."\n".
			 '		</tr>'."\n".
			 '	</table>'."\n".
			 '</td>'."\n";
		$row_count++;
	}
}
echo '</tr>'."\n". //Don't forget to end the row
	 '</table>';

//break; <--- What? Why here? I don't see any switches

if(isset($_POST['submit']) && $_POST['submit']=="Delete")
{
	mysql_query("DELETE FROM UserSites WHERE SiteNumber=".mysql_real_escape_string($_POST['SiteNumber']));
	echo '<strong>Site Deleted!</strong><br>'."\n";
	echo '<a href="'.$_SERVER['PHP_SELF'].'"'."\n";
}
//break; <--- What? Again? Why?
?>

It still could use a lot of work...but it should be functional now!

FlashCreations 20 Posting Whiz

Can you show your entire code then? It might help to see exactly how we can help with a precise solution...

FlashCreations 20 Posting Whiz

I have updated the script again to fix the notices (Your setup seems to be very picky about $_GET and $_POST variables!). To achieve what you are looking for, you will need some simple css. With the current code, all you need to do is add this style to the top of your page. The only other thing you will need to do is enclose the navigation inside a div with and id of nav like this:

<div id="nav">
<?php
//Show the navigation
$paginator->navigation();
?>
</div>

And here's the CSS to include:

#nav { font: normal 13px/14px Arial, Helvetica, sans-serif; }
#nav a { background: #EEE; border: 1px solid #DDD; color: #000080; padding: 1px 7px; text-decoration: none; }
#nav strong { background: #000080; border: 1px solid #DDD; color: #FFF; font-weight: normal; padding: 1px 7px; }

The only thing it doesn't do is apply the box (possibly a grayed out one) to the disabled Next and Previous links. If You wish for this to happen, reply back and I'll make the slight changes that are necessary for this to happen.

FlashCreations 20 Posting Whiz

I forgot to make this clear, but this is all assuming that you include a database connection file, or have some code you are not showing to connect to the DB. MySQL isn't just magic...you have to connect to it first:

mysql_connect("HOST", "USERNAME", "PASSWORD") or die("Connection Error!"); //The host is typically localhost, but
                                                                           //it depends on your server setup

mysql_select_db("DATABASE NAME") or die("Database Connection Error!"); //The database in which the table you 
                                                                       //wish to delete a row from is located
FlashCreations 20 Posting Whiz

Awesome! Well if your question has been answered (or solved by some self-changes, which seems to happen a lot! :) ), I ask that you mark the thread as solved. It always bugs me when I visit a thread that has been resolved, but hasn't been mark accordingly! :)

FlashCreations 20 Posting Whiz

If you are trying to create an uploader, look into PHP file handling and uploading on W3Schools to learn more. If not, simply follow my and JRM's advice: upload the image to your web root (or a folder inside of it) and then change your fopen so that it reflects the new location of the file.

FlashCreations 20 Posting Whiz

Then append the search variable to all of the pagination links. If the keyword is what's missing, also append this and add a snippet at the top to get the keyword from the URL like this:

if(isset(@$_GET['keyword']) $keyword = $_GET['keyword'];

If your code is still throwing notices like this when you allow users to access it, I would suggest turning error reporting off...

error_reporting(0); //Turn off all errors
error_reporting(E_ALL ^ E_NOTICE); //Allow fatal errors, but mute notices, this is the default setting for most PHP installations

If you do hide errors from users, but still want to be able to see them yourself, you can set up an errorlog file. Suppressing problem functions with @ will also work too as long as you don't have any surprise problems.

FlashCreations 20 Posting Whiz

Alright, let me look into this. Might just be a little error on my part!

Easy fix! Just a harmless little mix up of function names. Here's the updated version: http://files.phpmycoder.net/1209da/

FlashCreations 20 Posting Whiz

Or you could always combine it into one line (It just depends on your coding style):

mysql_query("DELETE FROM UserSites WHERE SiteNumber=".mysql_real_escape_string($_POST['SiteNumber'])); //Added missing parenthesis :)

To diagnose the problem with the row not being deleted, can we see the structure of your database (specifically the UserSites table)? A PhpMyAdmin screenshot would be nice!

FlashCreations 20 Posting Whiz

If short tags aren't enabled, then the code won't work. It also doesn't seem that you have mentioned the sitenumber problem in a query. I would still suggest:

<!doctype html>
<html>
<head>
<title>Input Name Test</title>
</head>
<body>
<?php
if(isset($_POST['submit']))
{
  switch($_POST['submit'])
  {
    case "Delete":
      mysql_query("DELETE FROM UserSites WHERE SiteNumber=".mysql_real_escape_string($_POST['SiteNumber']);
      echo 'Site Deleted!<br>'."\n";
    break;
    case "Other Action":
      //Other actions can be added with submit buttons with the name submit and a value that corresponds to a case in this switch 
    break;
  }
  echo '<a href="'.$SERVER['PHP_SELF'].'">Go Back</a><br>'."\n";
}
else
{
  echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">'."\n";
  echo '<label for="SiteNumber">Site Number:</label> <input type="text" name="SiteNumber"><br>'."\n";
  echo '<input type="submit" name="submit" value="Delete"><br>'."\n";
  echo '<input type="submit" name="submit" value="Other Action"><br>'."\n";
  echo '</form>'."\n";
}
?>
</body>
</html>
FlashCreations 20 Posting Whiz

I fully understand what extract is. Regardless, it poses a security flaw to extract $_GET and $_POST variables. The user would have free roam to set a variable, such as maybe a database to delete, a boolean that determines whether the user is an admin or not, or any other crucial value, to any value including ones that could compromise the script. Extracting $_GET, $_POST, or $_REQUEST is an idea with terrible consequences. I would advise against it.

FlashCreations 20 Posting Whiz

No that's perfectly correct, I just had a little trouble understanding you. So with that in mind, the links to other pages should include the search parameter. I don't know where the $keyword variable comes from, but it also should remain constant throughout the pagination.

FlashCreations 20 Posting Whiz
<?
ob_start();
extract($_POST);
extract($_REQUEST);
if($_POST['Delete']=='Delete')
{
echo $_REQUEST['sitenumer'];exit;
}
 ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
    	 
     <?
	 $a="?sitenumer=raju";
	   echo '<form action="'.$_SERVER['PHP_SELF'].$a.'" method="post" name="formx">';
     
      echo '<input type="submit" name="Delete" value="Delete">';
	  echo '</form>';?>
</body>
</html>

. i am trying to get sitenumber value. i got sitenumber value. modify above code as per your need.

But does it execute the Delete query? Also I believe you meant exit() . And what is the point of the exract() 's? You don't seem to use them anywhere (I would be especially careful with extracting $_GET and $_POST variables as it could pose a major security vulnerability!)

FlashCreations 20 Posting Whiz

Without having an internet connection. Wouldn't that defeat the purpose of writing a PHP script. You could use localhost and maybe XAMPP or LAMP, but without an internet connection. Why?
If you insist, you could always try a CSS graph like I had suggested before. It's not as elegant as the Google API and its sure not as easy, but it doesn't need an internet connection (It does need a browser, though!)

FlashCreations 20 Posting Whiz

But if the form submits data to post, then yes, it wouldn't work. But slightly modified it will:

onclick="javascript: document.form.currency.value='euro'; document.form.action=\"index.php?currency=euro\"; document.form.method=\"get\"; document.form.submit();"

Or you could do this:

<?php
session_start();
if (isset($_GET['currency']) && !empty($_GET['currency'])) {
$_SESSION['currency']=$_POST['currency'];
 
$v=explode('?','http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'],2);
$v[1]=str_replace('currency='.$_GET['currency'],'',$v[1]);
$v[1]=trim(str_replace('&&','&',$v[1]),'&?');
$j=$v[0];
$j.=(empty($v[1]))?'':'?'.$v[1];
header('Location: '.$j);
exit;
}

(If this does solve it, give credit to cwarn, because after all, it's his code!)

FlashCreations 20 Posting Whiz

What's between the parenthesis of the switch statement? I think what you are looking for is:

<!doctype html>
<html>
<head>
<title>Input Name Test</title>
</head>
<body>
<?php
if(isset($_POST['submit']))
{
  switch($_POST['submit'])
  {
    case "Delete":
      mysql_query("DELETE FROM UserSites WHERE SiteNumber=".mysql_real_escape_string($_POST['SiteNumber']);
      echo 'Site Deleted!<br>'."\n";
    break;
    case "Other Action":
      //Other actions can be added with submit buttons with the name submit and a value that corresponds to a case in this switch 
    break;
  }
  echo '<a href="'.$SERVER['PHP_SELF'].'">Go Back</a><br>'."\n";
}
else
{
  echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">'."\n";
  echo '<label for="SiteNumber">Site Number:</label> <input type="text" name="SiteNumber"><br>'."\n";
  echo '<input type="submit" name="submit" value="Delete"><br>'."\n";
  echo '<input type="submit" name="submit" value="Other Action"><br>'."\n";
  echo '</form>'."\n";
}
?>
</body>
</html>
FlashCreations 20 Posting Whiz
i think you arenot pass searching  text for every page. you are passing only start veriable only. check once

What?

FlashCreations 20 Posting Whiz

It is possible with JavaScript and the Google API or a CSS chart (again updated by JavaScript constantly polling a server page. This server page will echo data to the AJAX request and you can update your table there)

FlashCreations 20 Posting Whiz

Just a note:
When you find the number of pages, you want to find the ceiling (or highest integer) of the division since 1.5 of a page is actually two.

$pages = ceil($item_count / $per_page);

Also, does the error message (notice) given you a line number?

FlashCreations 20 Posting Whiz

Well there's SWF charts that rely on XML files for data. You could make the XML file dynamic with PHP and have the SWF poll the file every fifteen seconds or so. XML/SWF Charts would be an option for this.

The other way, would be with Javascript and CSS. Sometime ago I read an article about creating graphs in CSS. I'll look for it and post back when I find it.

EDIT:
Here's the link: Pure CSS Graphs

FlashCreations 20 Posting Whiz

Well you could create a form and when the admin submits it, update the movie status with a MySQL query:

status.php

<html>
<head> 
<title>Rental Demo - Created By PhpMyCoder</title>
</head>
<body>
<?php
if(isset($_POST['submit']))
{
  if($_POST['movie1']==1) mysql_query("UPDATE movies SET available='1' WHERE name='movie1'");
  else mysql_query("UPDATE movies SET available='0' WHERE name='movie1'");
}
?>
<form action="status.php" method="post">
<?php  if(mysql_num_rows(mysql_query("SELECT name FROM movies WHERE name='movie1' AND available='1'"))==1): ?>
Movie Name <input type="checkbox" name="movie1" value="1" checked>
<?php else: ?>
Movie Name <input type="checkbox" name="movie1" value="1">
<?php endif; ?>
<input type="submit" value="Set Movie Status">
</form>
</body>
</html>
FlashCreations 20 Posting Whiz

Alright, I think the problem is both of the arguments you are passing are arrays by themselves, but when you specify a part of the array, you are no longer passing an array. Maybe the in_array() isn't the function you are looking for.