kevin wood 29 Posting Whiz

this code will delete all the files from a directory on the server. be careful when using this as it will delete everything in the directory so use it wisely or make sure you have backups if it is implemented on the wrong directory.

it works by searching for all the file which have a full stop (.) in side the file name. it does not matter what the extension is it will be deleted.

kevin wood 29 Posting Whiz

This code will display images within an email from the server. It will display an image with a choice of file extension which can be expanded to fit your needs.

this code was originally developed for a emailing system where the images to be displayed where uploaded by the user.

LastMitch commented: Thanks for sharing! +12
kevin wood 29 Posting Whiz

you can. if you use the following code this will work if your server will allow you to use .htaccess files.

php_value post_max_size 128M
php_value upload_max_filesize 128M
php_value memory_limit 300M

i went about it a slightly easier way tho by putting the following code inside the php script before the image is processed

ini_set('memory_limit', 'xxM')
kevin wood 29 Posting Whiz

is it possible to change the max file upload and the memory limit allowed for file uploads in php with a .htaccess file.

the server my website is held on will not give me access to the php.ini file and is running php 4.4.9

kevin wood 29 Posting Whiz

thanks once again for your help.

i had tried nearly every variation of putting the echo in different places and closing it out on different lines. just didnt think about the fact that the page was php and didnt need the html tags to display the php variables.

thank you again

kevin wood 29 Posting Whiz

this code was working fine until i changed the way the site loads the content (it now loads the content into a div tag) and since then it will not populate the menu.

the page can be viewed at

this site

you will need to go to the sub links on the left and click the Register Interest in Courses link.

here is the code that is not working

case 10:
			echo'';
			$db = "pipdb"; 
			$con = mysql_connect("localhost","pip","piptables")or die(mysql_error());
			
			mysql_select_db($db)or die(mysql_error());
			$query="SELECT id, title FROM training";
			$result = mysql_query($query) or die(mysql_error());
			
			$options = "";
			
			while ($row=mysql_fetch_array($result)) {
			
				$id = $row['id'];
				$title = $row['title'];
				$options.="<OPTION VALUE=\"$id\">".$title;
			}
			
		echo'<form action=\"insert_interest.php\" method=\"POST\">

		<h4>Select which course you would like to register your interest in</h4>
		
		<h5>Option 1</h5>
		   <select name=\"radio\">
				  <OPTION VALUE=0>Please select an option
				  <?=$options?>
		   </select>
		<h5>Option 2</h5>
		(only select more options if needed)<br />
		<br />
			<select name="radio1">
				<OPTION VALUE=0>Please select an option
				<?=$options?>
		    </select>
		<h5>Option 3</h5>
			<select name="radio2">
				<OPTION VALUE=0>Please select an option
				<?=$options?>
		    </select>
		    <br /><br /><h4>Enter the required information</h4>
		    <b>Name:</b><br />
		    <input type="text" name="name" /><br />
		    <b>Address:</b><br />
		    <textarea cols="50" rows="7" name="address" onkeyup="textLimit(this, 150);"></textarea><br />
			<b>Housing Association:</b><br />
		    <input type="text" name="housing" /><br />
		   <b>Email:</b><br />
		   <input type="text" name="email" /><br />
		   <br />
		   <input type="submit" value="Register Interest" />
		      </p>
		</form>';
				break;

any help would be great with this.

i know it has something to do with how i am echoing the information out.

kevin wood 29 Posting Whiz

very strange i nearly pulled all my hair out yesterday trying to fix that problem. no worries i got a new problem now i will start a new post.

kevin wood 29 Posting Whiz

i removed the centre from the table and it worked fine but before that the scrollbar just wouldnt show. i was viewing it first in ie7 with the table centred and the scrollbar was not visible.

kevin wood 29 Posting Whiz

sorted. took the centre from the table in the second section of the code and it has decided to work now.

if someone could shed any light on why this happened please do so.

kevin wood 29 Posting Whiz

i have these two pages of information which are stored on a php page which then feeds the main div tag on the index page.

the problem i have here is that a scrollbar shows up on the first page but not the second. so to see the rest of the information on the page the user needs to click iun the div and scroll with the mouse or the arrow keys.

i cannot work out for the life of me why this is happening (and i know it is prob starring right at me with two fingers up laughing)

here is the code for the page were the scrollbar is visible and works

case 2:
         echo '';
      $db = "pipdb";
      $con = mysql_connect("localhost","***","*******")or die(mysql_error());

      mysql_select_db($db)or die(mysql_error());
      $result = mysql_query("SELECT * FROM ***** ORDER BY id DESC") or die(mysql_error());
      echo "<div style=\"height: 500px; width: 450px; overflow:auto;\">";
      echo "<table width=350px border=0>\n";
      // keeps getting the next row until there are no more to get
      while($row = mysql_fetch_array( $result )) {
         // Print out the contents of each row into a table
         echo "<tr><td>";
         echo $row['date'];
         echo "</td></tr>";
         echo "<tr><td><b>";
         echo $row['title'];
         echo "</b></td></tr>";
         echo "<tr><td>";
         if(!empty($row['image'])) {
         echo '<img src="images/'.$row['image'].'">';
         }
         echo $row['article'];
         echo "</td></tr>";
         echo"<tr><td>&nbsp;</tr></td>";
      }

echo "</table>";
echo "</div>";
         break;

and the code where the scrollbar is not visible

case 8:
         echo "<div style=\"height: 500px; width: 300px; overflow:auto;\">";
      echo'<table width=100% border=0 align="center">
                  <tr>
            <td><h2><b>Cobalt Housing</b></h2>
               Cobalt Housing<br />
               Cobalt Housing<br />
               Cobalt Housing<br />
               Cobalt Housing<br …
kevin wood 29 Posting Whiz

it was a spelling mistake stopping

kevin wood 29 Posting Whiz

i have built a page which loads content into a div tag from a php page using javascript.

the problem i am having is that the title for eachg page is not inside the div so i keep being left with the same title on each page.

i have tried to change the image using the onmouseup/down functions but this has not worked.

here is the code for the functions

function loadContent(id) {
			$("#contentArea").load("rpc.php?o="+id+"");
		}
		
		function roll(img_name, img_src)
   		{
   			document[img_name].src = img_src;
	   }
	   function click(img_name, img_src)
	   {
	   		document[img_name].src = img_src;
	   }

here is the code for the button

<a href="javascript:loadContent(1);" onmouseover="roll('about_but', 'buttons/about_but2.png')" onmouseout="roll('about_but', 'buttons/about_but.png')" onmousedown="click('title_img', 'assets/homeP_title.png')" onmouseup="click('title_img', 'assets/aboutP_title.png')"><img src="buttons/about_but.png" name="about_but" border="0" align="left"/></a>
kevin wood 29 Posting Whiz

if you look for the section where the values of $consname and $consname2 are set you can change where the files are stored on the server there.
if you want the oiginal image stored in the images folder then the line of code should look like this

$consname="images/".$image_name;

and the thumbs to be stored in a thumb folder the next line of code will be

$consname2="thumb/".$image_name;
kevin wood 29 Posting Whiz

thank you for the reply i ended up getting it working late last night with a similar piece of code. thank you again for the reply.

kevin wood 29 Posting Whiz

a foreach loop will need to start with a while loop and i do not see the need to use the id of the table as i only need to loop through the email address and user these to send the email.

kevin wood 29 Posting Whiz

i am trying to get this code to work but there is something wrong with the array (not to good at these). the main part of the code works it is sending out the email but only ever to one registered user.

here is the code i have so far.

$query = "SELECT email FROM emails";
	$result = mysql_query($query) or die(mysql_error());

	while($row = mysql_fetch_array($result)) {
	
	$contactemail = $row['email'];
	



	// Contacts
	//$replyName = $merc_replyId;
	//$replyEmail = $merc_replyAddress;
	
	$replyName = "PiPonliine";
	$replyEmail = "info@piponline.info";

	$contactname = "";
	

	// Subject
	$subject = "Website Update";

	// Headers
	$headers = "MIME-Version: 1.0" . PHP_EOL;
	$headers .= "Content-type: text/html; charset=iso-8859-1" . PHP_EOL;
	$headers .= "From: ".$replyName." <".$replyEmail.">" . PHP_EOL;
	$headers .= "BCC: ".$contactname." <".$contactemail.">\r\n" . PHP_EOL;
	

	mail($contactemail, $subject, $message, $headers);
	}
  echo "$contactemail";
  echo "<h2>Email notification sent</h2>";
  echo "<h2>1 record added</h2>";

  mysql_close($con);
kevin wood 29 Posting Whiz

this code stores the path to the image in the db an stores two copies of the image on the server. the original and the newly created thumbnail image.

you will need to create a folder called image and one call thumb inside of that.

kevin wood 29 Posting Whiz

the sleep function pauses the mysql statement. i cannot see how that would solve the problem of my array not being populated.

kevin wood 29 Posting Whiz

i have changed the code slightly now and have got it sending out one email. i have narrowed the problem down to the mysql query as this is not populating the array it is only putting on email address in.

here is the code for the mysql statement

$query = "SELECT email FROM emails";
	$result = mysql_query($query) or die(mysql_error());

	while($row = mysql_fetch_array($result)) {
	
	$contactemail = $row[0]. ", ";
	}
kevin wood 29 Posting Whiz

i am trying to write a script that will send out an email to all the email addresses stored in a mysql db when the site has been updated. the code i have so far is as follows

$sql= "INSERT INTO $table (date, title, article) VALUES ('$a', '$b', '$c')";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
  $lastid = mysql_insert_id();
  
  $message .= '<body leftmargin="0" topmargin="0">
	<table width="700" border="0" align="center" cellpadding="0" cellspacing="5">
    <tr>
		<td>The ' . $table . ' section of the <a href="piponline.info"> PiPonline website</a> has been updated.  Please follow the link to see the new content.
	</tr>
  </table>
  </body>';


	$query = "SELECT email FROM emails";
	$result = mysql_query($query) or die(mysql_error());

	while($row = mysql_fetch_array($result)){
	$contactemail = $row['email']. ", ";
	}



	// Contacts
	//$replyName = $merc_replyId;
	//$replyEmail = $merc_replyAddress;
	
	$replyName = "PiPonliine";
	$replyEmail = "info@piponline.info";

	$contactname = "";
	

	// Subject
	$subject = "Website Update";

	// Headers
	$headers = "MIME-Version: 1.0" . PHP_EOL;
	$headers .= "Content-type: text/html; charset=iso-8859-1" . PHP_EOL;
	$headers .= "From: ".$replyName." <".$replyEmail.">\r\n" . PHP_EOL;
	$headers .= "BCC: ".$contactname." <".$contactemail.">\r\n" . PHP_EOL;
	

	mail(implode(',', $contactemail), $subject, $message, $headers);
  echo "$contactemail";
  echo "<h2>Email notification sent</h2>";
  echo "<h2>1 record added</h2>";

  mysql_close($con);

this code is giving me the following error message which as far as i know means that array is not being populated.

Warning: implode(): Bad arguments

due to the error the emails are not being sent even if the code for that section is correct or not.

kevin wood 29 Posting Whiz

well i still got my job so i cannot be doing that bad. thanks again take it easy and have fun.

kevin wood 29 Posting Whiz

thanks for the reply nav33n i have been looking for missing semo colons. which is usually my problem. hope u all good ne way not been on here for a while. must say something about the help you gave me in the past.

kevin wood 29 Posting Whiz

i have this line of code which i cannot see a problem with but i keep getting an error.

$sql= "INSERT INTO emails (Firstname, Lastname, email, table) VALUES ('$a', '$b', '$c', '$table')";

the error i keep getting is

Error: You have an error in your SQL syntax near 'table) VALUES ('kevin', 'wood', 'kevin_wood@xxxxxxxx', 'news')' at line 1

the values are being passed to this page fine but it still gives me this error.

any help would be much appreciated.

kevin wood 29 Posting Whiz

sorted changed the code to this and it works fine now

print "<h4>There are $num_rows records.<P></h4>";
echo "<div style=\"height: 150px; width: 100%; overflow:auto;\">";
print "<table width=600 border=0>\n"; 
while ($get_info = mysql_fetch_row($result)){ 
print "<tr>\n"; 
foreach ($get_info as $field) 
print "\t<td><font face=arial size=1/>$field</font></td>\n"; 
print "</tr>\n"; 
} 
print "</table>\n";
print "</div>";
kevin wood 29 Posting Whiz

not sure if this is the correct place to post but here we go anyway.

what i am trying to do is put a table inside a div tag held within a php page but it is not working. here is the code

print "<h4>There are $num_rows records.<P></h4>";
print "<div style=\"width: 650; height:50; overflow-y: scroll\">";  
print "<table width=600 border=0>\n"; 
while ($get_info = mysql_fetch_row($result)){ 
print "<tr>\n"; 
foreach ($get_info as $field) 
print "\t<td><font face=arial size=1/>$field</font></td>\n"; 
print "</tr>\n"; 
} 
print "</table>\n";
print "</div>";

the scroll bar does not get used as the table just keeps expanding down the page.

kevin wood 29 Posting Whiz

the variable echo's out until the code is ran for the upload of the image then it decides to go missing and i cannot work out why this is happening.

kevin wood 29 Posting Whiz

try this code out i have no problems with the image quality with it.

<?php

			

set_time_limit(0); 
		
$link  =  mysql_connect(localhost, xxxxxxxx, xxxxxxxxx) or die("Could not connect to host.");  //put in your db connection details here
mysql_select_db(xxxxxxx) or die("Could not find database.");  // put your db name in here where the xxxx are
		
		
		
		
 //define a maxim size for the uploaded images
define ("MAX_SIZE","500"); 
// define the width and height for the thumbnail
 // note that theese dimmensions are considered the maximum dimmension and are not fixed, 
 // because we have to keep the image ratio intact or it will be deformed
 define ("WIDTH","150");  //set here the width you want your thumbnail to be
 define ("HEIGHT","120");  //set here the height you want your thumbnail to be.
		
 // this is the function that will create the thumbnail image from the uploaded image
// the resize will be done considering the width and height defined, but without deforming the image
 function make_thumb($img_name,$filename,$new_w,$new_h)
{
//get image extension.
$ext=getExtension($img_name);
//creates the new image using the appropriate function from gd library
if(!strcmp("jpg",$ext) || !strcmp("jpeg",$ext))
$src_img=imagecreatefromjpeg($img_name);
		
if(!strcmp("png",$ext))
$src_img=imagecreatefrompng($img_name);
			
if(!strcmp("gif",$ext))
$src_img=imagecreatefromgif($img_name);
		
//gets the dimmensions of the image
$old_x=imageSX($src_img);
$old_y=imageSY($src_img);
		
 // next we will calculate the new dimmensions for the thumbnail image
// the next steps will be taken: 
// 	1. calculate the ratio by dividing the old dimmensions with the new ones
//	2. if the ratio for the width is higher, the width will remain the one define in WIDTH variable
//		and the height will be calculated so …
kevin wood 29 Posting Whiz

is that some javascript?

kevin wood 29 Posting Whiz

i have a column named id which is set to auto increment. this code should update the table depending on what id number the user chose on a previous page. the id the user chose is posted over and stored in the variable $id_num which i am able to echo out at the top of the page for some reason the valus seems to be getting lost while the runs through the creation of the thumbnail.

kevin wood 29 Posting Whiz

as for doing this without the click of a submit but you would have to look at HTTP_REQUEST to upload the images without the click of a submit button. the code for the upload will keep the user on the same page as the upload and once the image is uploaded it will display a thumbnail image of it above the submit button.

to remove the files i would again use a form and save that code on to it own php page and target the page from the action section within the form

kevin wood 29 Posting Whiz

here is the code to delete all file from the server once you no they are not needed. be careful when this code is used as it will delete every file from within the specified filder in the $dir variable.

$dir = 'your/directory/';
      foreach(glob($dir.'*.*') as $v){
      unlink($v);
      }
kevin wood 29 Posting Whiz

here is the code for the upload of the image. your mysql table should have two columns one which is called id which is set to auto increment and the other which is called image.

<?php

			

set_time_limit(0); 
		
$link  =  mysql_connect(localhost, xxxxxxxx, xxxxxxxxx) or die("Could not connect to host.");  //put in your db connection details here
mysql_select_db(xxxxxxx) or die("Could not find database.");  // put your db name in here where the xxxx are
		
		
		
		
 //define a maxim size for the uploaded images
define ("MAX_SIZE","500"); 
// define the width and height for the thumbnail
 // note that theese dimmensions are considered the maximum dimmension and are not fixed, 
 // because we have to keep the image ratio intact or it will be deformed
 define ("WIDTH","150");  //set here the width you want your thumbnail to be
 define ("HEIGHT","120");  //set here the height you want your thumbnail to be.
		
 // this is the function that will create the thumbnail image from the uploaded image
// the resize will be done considering the width and height defined, but without deforming the image
 function make_thumb($img_name,$filename,$new_w,$new_h)
{
//get image extension.
$ext=getExtension($img_name);
//creates the new image using the appropriate function from gd library
if(!strcmp("jpg",$ext) || !strcmp("jpeg",$ext))
$src_img=imagecreatefromjpeg($img_name);
		
if(!strcmp("png",$ext))
$src_img=imagecreatefrompng($img_name);
			
if(!strcmp("gif",$ext))
$src_img=imagecreatefromgif($img_name);
		
//gets the dimmensions of the image
$old_x=imageSX($src_img);
$old_y=imageSY($src_img);
		
 // next we will calculate the new dimmensions for the thumbnail image
// the next steps will be taken: 
// 	1. calculate the ratio by dividing the old dimmensions with the new ones
//	2. if the ratio for the …
kevin wood 29 Posting Whiz

i would store the image on to the server and save the path to the image into a mysql db. once you have the path to the image inside the db you can use the mysql function to fined the last entry inside the mysql table and only display that where you want.

i will post you the code to upload and store your image onto the server with the code into update the last record inside the mysql db.

i will also give you the code so that you can periodically empty out the folder that is storing all the images on the server.

kevin wood 29 Posting Whiz

so what you want to do is upload an image on to the server so it can be used where it is needed. then if another image is uploaded you want this to be over write the old image and for the new image to be used instead.

kevin wood 29 Posting Whiz

hope someone can help me with this.

i am trying to update records in a mysql db with a new image but i keep gettin errors.

i am using a hidden form input to post a variable across to a new page, i can echo the variable out at the top of the page but it will not update the database using this variable.

here is the code i am using to pass the variable across to the new page.

echo "<form action=\"$page\" method=\"post\">";
echo "<input type=\"hidden\" name=\"id_num\" value=\"$id\" />";
echo "<input type=\"submit\" value=\"Upload Image\"/>";
echo "</form>";

then the code for the page that handles this data is as follows.

<?php

$id_num = $_POST['id_num'];
echo "$id_num";    //echo's out the number from the previous page
		
set_time_limit(0); 
		
$link  =  mysql_connect(localhost, xxxxxxxx, xxxxxxx) or die("Could not connect to host.");
mysql_select_db(xxxxxxdb) or die("Could not find database.");
		
		
		
		
//define a maxim size for the uploaded images
define ("MAX_SIZE","500"); 
// define the width and height for the thumbnail
// note that theese dimmensions are considered the maximum dimmension and are not fixed, 
// because we have to keep the image ratio intact or it will be deformed
define ("WIDTH","150"); 
define ("HEIGHT","120"); 
	
 // this is the function that will create the thumbnail image from the uploaded image
// the resize will be done considering the width and height defined, but without deforming the image
 function make_thumb($img_name,$filename,$new_w,$new_h)
 {
//get image extension.
$ext=getExtension($img_name);
//creates the new image using the appropriate function from gd library
if(!strcmp("jpg",$ext) || !strcmp("jpeg",$ext)) …
kevin wood 29 Posting Whiz

i hate programming!!

not really it wouldnt work coz i aint put ' ' around my variable names in the update code.

kevin wood 29 Posting Whiz

the way it is working (i no it is not the best way to do it) is when the user uploads an image it will be to go with the last article added so th highest number in the id column will work fine in this situation.

kevin wood 29 Posting Whiz

that section of code is working now it is giving me the number of the last entered row.

my update query is not working tho it is not putting the image into the db. here is my code for this section including the code you have helped with

$run=mysql_query('select max(id) from internal');
$lastid = mysql_fetch_row($run);
$lastid=$lastid[0];
$sql="UPDATE internal SET image = $consname2  WHERE id = $lastid";
$query = mysql_query($sql);

it shows the number for the last row in the db when the page is first loaded then the user enters the article information it goes to a page that tells them if it was inserted then they are redirected to the page where they entered the article. once back on this page the user then has the option of uploading an image. (the reason for it working this way is that the image upload section is only just being added)

when the user is redirected to the page the number of the last row disappears from the page. i have echoed this out for testing purposes and it shows when the page is first loaded.

kevin wood 29 Posting Whiz

spelling mistake ignor last post

kevin wood 29 Posting Whiz

it dont like this line

$lastid = mysql_fetch_row($run);

i get this error

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/acmeart/public_html/flashtest/index.php on line 204
kevin wood 29 Posting Whiz

so if i use the select max(id) would i beable to do something like

select max(id) from interal;
$lastid=max(id);
$sql = update internal set image = $image where id = $lastid;
kevin wood 29 Posting Whiz

i have set up a mysql db for storing news articles to be displayed within a flash website. i have now been asked if i could add an image upload function to this section.

i have created the upload page and i can upload the images to the db fine. the problem that i have is that when the image is uploaded it is put into its own row in the db. i need to be able to have the code find the last entry in the db and then update this entry with the image that is uploaded.

i would like to no if there is a function within mysql that can find the last entry. i have set the table up with an id which is auto incremented. i would like to no if i can find out what the last id number is and then update the row using the id number

kevin wood 29 Posting Whiz

sorted. the proble was with the hidden form data i was trying to pass the data on for them wrong. here is wat was wrong

echo "<input type=\"hidden\" name=\"dropdown\" value=\"{$db['dropdown2']}\" /><br /><br />";
echo "<input type=\"hidden\" name=\"radio\" value=\"{$table['radio2']}\" /><br /><br />";
echo "<input type=\"hidden\" name=\"id\" value=\"{$id['id']}\" /><br /><br />";

here is what i changed it to to get it to work

echo "<input type=\"hidden\" name=\"dropdown2\" value=\"$db\" /><br /><br />";
echo "<input type=\"hidden\" name=\"radio2\" value=\"$table\" /><br /><br />";
echo "<input type=\"hidden\" name=\"id\" value=\"{$id['id']}\" /><br /><br />";

you may notice that i did not change the id section. this did not change as it was being sent to the next page with no problems. the only reason i can think that it was having difficulty with the other two sections was that they where passed to the first page using hidden form data. if anyone can explain this problem to me them please do as i have fixed the problem but do not understand why it was being caused in the first place.

kevin wood 29 Posting Whiz

i have tried to do this using the post method bit i am not getting the correct values sent through to the next page. here is the code for the data which i sent to the first page in question

$id = $_POST['id'];
$db = $_POST['dropdown2'];
$table = $_POST['radio2'];

then i have a form at the bottom which is populated using a mysql query. this page is used for editing data entered into a mysql db. here is the code for the form

$sql = ("SELECT * FROM $table WHERE id = $id");
$result = mysql_query($sql);

$row = mysql_fetch_array($result) or die(mysql_error());
echo "<form action=\"update.php\" method=\"post\">";
echo "Date:&nbsp;<input type=\"text\" name=\"date\" value=\"{$row['date']}\" /><br /><br>";
echo "Title:&nbsp;&nbsp;<input type=\"text\" name=\"title\" value=\"{$row['title']}\" /><br /><br />";
echo "<input type=\"hidden\" name=\"dropdown\" value=\"{$db['dropdown2']}\" /><br /><br />";
echo "<input type=\"hidden\" name=\"radio\" value=\"{$table['radio2']}\" /><br /><br />";
echo "<input type=\"hidden\" name=\"id\" value=\"{$id['id']}\" /><br /><br />";
echo "Article:<br /><textarea cols=\"50\" rows=\"10\" name=\"article\" onkeyup=\"textLimit(this, 500)\">{$row['article']}</textarea><br />";
echo "<input type=\"submit\" />";
echo "</form>";

that bit works fine but when i go to the update page which has this code at the top

$db = $_POST['dropdown'];
$table = $_POST['radio'];

$id = $_POST['id'];

$a = $_POST['date'];
$b = $_POST['title'];
$c = $_POST['article'];

i can echo out values for all the variable except $db and $table i get values for them which are c and i.

any help with this would be great

kevin wood 29 Posting Whiz

i am trying to set session variable using a form but i ahve never done this before and i am unsure of how this is done. i have had a look at a few examples on line but still i am not clear on how this works.

here is what i have up to now to register the variables

<?php
session_start();
$_SESSION["dropdown"];
$_SESSION["radio"];
$_SESSION["dropdown2"];
$_SESSION["radio2"];
?>

i have a form on the page which has different form elements which are named dropdown, radio etc. if i want it to record what choices the user has made on the form will this work.

if i want to use these on the next page would i write something like this

<?php
session_start();
$_SESSION["dropdown"] = $db;
$_SESSION["radio"] = $table;
$_SESSION["dropdown2"] = $db2;
$_SESSION["radio2"] = $table2;
?>

would $db be set to the value taken from the form?

kevin wood 29 Posting Whiz

there was no need i was just being stupid i have sorted it out now. thanks for the reply anyway

kevin wood 29 Posting Whiz

i am trying to submit three forms with the one button using javascript.

here is my code

<script type="text/JavaScript">

function submitForms(){
document.dropdown.submit();
document.radio.submit();
document.form.submit();
}

 function textLimit(field, maxlen) {
if (field.value.length > maxlen + 1)
alert('your input has been truncated!');
if (field.value.length > maxlen)
field.value = field.value.substring(0, maxlen);
} 

</script>
</head>

<body>
<form name="dropdown" action="insert.php" method="POST">
<select name="dropdown">
<option value="constructiondb">Construction</option>
<option value="electricaldb">Electrical</option>
<option value="technicaldb">Technical</option>
</select>
</form>
<br />
<form name="radio" action="insert.php" method="POST">
	News Section::<br />
	General News:<input type="radio" value="General News" name="general"><br />
	Internal News:<input type="radio" value="Internal News" name="internal"><br />
</form>
<br />
<form name="form" action="insert.php" method="POST">
	Date:&nbsp;<input type="text" name="date" /><br /><br>
	Title:&nbsp;&nbsp;<input type="text" name="title" /><br /><br />
	Article:<br /><textarea cols="50" rows="10" name="article" onkeyup="textLimit(this, 500);"></textarea><br />
</form>
<input type="button" onclick="submitForms()" value="Submit">

the data which i want to send to the next page does not seem to being passed over though. when i try to echo out the variables nothing is being printed on the page.

any help would be great

kevin wood 29 Posting Whiz

i have gone about it differently now. to make it easier i just made the flash file i was putting on the page a lot bigger centred the first table and it has given me the outcome i wanted.

kevin wood 29 Posting Whiz

hello i have a simple logo on a splash page which i want to align to the centre of the page. when i have it dreamweaver 8 it is aligned to the centre of the page but when it is viewed on the browser it goes to the top.

i know splash pages are not a nice thing anyway but i have been asked to add one to the website. i have done this before but for the life of me cannot remember how i done this last time. here is my code up to now.

<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr valign="middle">
	<td align="center" valign="middle">
		<div align="center" style="vertical-align:middle"><table width="770" border="0" align="center" cellpadding="0" cellspacing="0" id="table2">
 			 <tr>
   			   <td align="center" valign="middle"><script type="text/javascript">
					AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width','266','height','211','title','logo','src','logo','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','logo' ); //end AC code
					</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=			"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="266" height="211" title="logo">
      				<param name="movie" value="logo.swf" />
      				<param name="quality" value="high" />
      				<embed src="logo.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="266" height="211"></embed>
			   </object></noscript></td>
  			</tr>
	  </table></div>
	</td>
</tr>
</table>

as you can see i have tried nested tables, div tags, css and the valign attribute of the <td> tag all with no joy.

any help on this would be great.

kevin wood 29 Posting Whiz

as iframes are now depreciated as of xhtml 1.0 Strict is there away to replace these using Ajax.

this is something i have heard off but have never come across and would like to know if this is possible. I have used iframes in the past to display content from other pages and new content for pages i have built built.

if it is possible to use Ajax to replace iframe could someone please point me in the direction of a good tutorial on this.