Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Getting The Remote File Path From <input Type="file">


I'm using a form to upload a file to save in a mySQL database, however I need to store the original file path on the clients (the user uploading the file) computer.

The file path is shown in the field that selects the file, I just need to post it or save it in a session somehow.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Multiple File Upload From Client Pc To Server Without Using <input Type="file"> Cont
I am working on a application which requires me to upload the contents of all the files from a particular folder in clent pc to the server.

In my code i just want to mention the folder name which may contain any number of files.Folder name will always be fixed.
I dont want to use <input type=file > control.

Is there any way i can achieve this using FTP or any other way in PHP.Any help will be greatly appreciated.

Validation Return Query? - Type="file"
When a user clicks submit on my form, it will return with a list of errors and will populate all the fields with the correct data that the user has already entered.
ie.. <input name="contact_name" type="text" value="<?print $contact_name; ?>">

... and so on throughout the form. This works fine except for when I try and populate a file textfield with the file the user has tried to upload.

<input style="width:200px; "  name="userfile" type="file"  id="menu_textbox" value="<?print $target; ?>" />

I am not sure how to approach this. When the user hits submit and  the form returns errors . . the files path will not be saved to the database. But as I dont know how to populate type="file" with the file the user already selected, when they hit submit again. obviously no file will be uploaded.

PHP Form Submission <input Type="hidden"> Security Issues?
Someone has said to me that when using a form (method = post), that storing data in "hidden" tags

ie <input type="hidden" name="myField" value="something">
means that the user can set the value to whatever they like

So my questions are:

1.  How would they do this
2.  How can I stop it
3.  Do I have to abandon the hidden values and go with sessions?

Losing $_POST Data With Input Type="image"
I am having problems with a php script that I am developing. I have a file called "login.php". It contains an HTML form with a username and password field, and is submitted with an image.

Here is a simplified version of my form:

<form name="form1" action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
<input type="text" size="20" maxlength="50" class="text" name="uname">
<input type="password" size="20" maxlength="12" class="text" name="passwd">
<input type="image" src="images/b-login.jpg" border="0" name="submit">
</form>

As you can see, the script calls itself. However, when I try to access $_POST['uname'] and $_POST['password'], they do not exist.

If I replace the line

<input type="image" src="images/b-login.jpg" border="0" name="submit">

with

<input type="submit" name="submit" value="Login">

everything works fine. I need to use this image to submit my form, not the standard "Submit" button. Any ideas on what the problem is?

'echo "": No Such File Or Directory" Error Using "exec" To Pipe In PHP Script
[TCL]
set php {<? print_r("Hello World"); ?>}
puts $php; # PRINTS OUT <? print_r("Hello World"); ?>
puts [exec "echo '$php' | php -q"]
[/TCL]

When I try this within TCL I get the following error:

Input Type="image" $_POST Queries
I'm trying to set up a 'control panel' consisting of a table of icons.

The early stages: http://www.deepinit.com/controlcentre.php

Each of these is set up like:

<td>
<input type="image" id="addnews" src="/Image/add24.png"
name="addnews" value="addnews" width="24" height="24"><br />
<label for="addnews">Add News Item</label><br />
</td>

This is all taking place in a html form and I'm using input
type="image"... like 'submit' buttons.

Is this a 'good' approach?

I'm trying to handle the $_POST variable after a user clicks on one of
these but there are differences between firefox and ie6.

Using:
foreach ($_POST as $key=>$val) {
echo $key ."|". $val . "<br />";
}

ie6 is only listing
addnews_x|8
addnews_y|17

Firefox:
addnews_x|10
addnews_y|13
addnews|addnews

Why am I getting x and y co-ordinates?

Why in firefox do I get $val ('addnews|addnews') but not in ie6?

What I'm trying to do is redirect to other pages based on $_POST:

foreach ($_POST as $key=>$val) {
switch (strtolower($key)) {
case 'addnews_x':
PostHandler('addnews', 'news', '/posteditor.php');
break;
case 'editnews_x':
PostHandler('editnews', 'news', '/postsearch.php');
break;
case 'deletenews_x':
PostHandler('deletenews', 'news', '/postsearch.php');
break;
...

function PostHandler($command, $post_type, $redir_page) {
$_SESSION['ctlcentcmd'] = $command;
$_SESSION['posttype'] = $post_type;

ob_end_clean();
header('Location: http://' . $_SERVER['HTTP_HOST']
. $redir_page);
}

This is working but I'm not happy basing this on the x co-ordinate
(eg addnews_x). Surely there must be a better way?

If you wanted to implement a similar icon based 'Control Centre' what
approach would you take? The intent is to have a single page where the
site admin can add/edit/delete news, articles, bios, user data, etc

"No Input File Specified."
As an experiment I wrote a simple C program that invokes
PHP using system(), but I'm getting an error "No input file
specified.".

What I do is:

setenv ("REQUEST_METHOD", "GET", 1);
setenv ("QUERY_STRING", "abc=123", 1);

and then I invoke PHP thus:

system "/usr/local/bin/php myfile.php < dummyfile > foo";

where dummyfile is either empty or just contains the line
"abc=123".

Yet, I get this error. No finnagling is fix it.



Echo "<!--#include File="top.html" -->";
I have a search script which returns a page of results, however I'd like the returned page to be in the same format as the rest of my site.
To do this I've tried adding the HTML for my site to my PHP page with echo" " commands. This works for the plain HTML, but my regular pages also use SSI to do other stuff (some of them even execute other PHP scripts to generate tables of data etc). I've tried

echo "<!--#include file="top.html" -->";
but it doesn't work as I get a parse error. My question is, how do I go about doing this properly? Is this possible at all? And if not have you guys got any suggestions to get around this?

Any File Size Limit In <PARAM Name="***" Value="***"> ?
I embed an applet in my php script which has a parameter providing an
input file for the jar. Does this file has size limit?

The code is as follows:
<APPLET ARCHIVE="myapplet.jar" WIDTH=372 HEIGHT=360 VSPACE=0 HSPACE=0
ALIGN=middle>

<?php echo "<PARAM NAME="data" VALUE="myfile.">";?>

when "myfile" is beyond 15M, my applet cannot load sucessfully, but
while this file is limited like 5M or 7M, it works well.

Does anybody know is the reason caused by php script limit, applet
mechanism, or by different browser?

Form "file" Field, Browse For Certain File Types.
I know I can't control the default browse when the user clicks browse next to a form file field. I.E *.pdf, *.jpg. Its just *.* - and I remember its something to do with security....but I cant remember the reasoning.

Failed To Connect To Mailserver At "localhost" Port 25, Verify Your "SMTP" And "smtp_port" Setting In Php.ini
Warning: mail(): Failed to connect to mailserver at "localhost" port 25,
verify your "SMTP" and "smtp_port" setting in php.ini

in php.ini I have:

SMTP = localhost
SMTP_PORT = 25
SENDMAIL_FROM = NULL
SENDMAIL_PATH = "H:WINNTsystem32" (this is where sendmail.dll is
sitting. H is the drive with w2k)

Other PHP code on that page is working.

What else should I check?

Displaying File Path In File Input Field
i have file input field in a form like this:
<input name="isbn" type="text" size="25" value="<?php echo
$_POST['isbn'] ?>" />
<input name="image" type="file" size="25" value="<?php echo
$_FILES['image']['name'] ?>" />

when i press "submit" button, the same page gets loaded... if my
$_POST['isbn'] is empty, i want to have the file path on "file input
field" to redisplay on that same field... it's possible in text input
field but i don't know of a way to do it in file input fields...

Can't Install PHP - Keep Getting "Invalid Directory" Error Regarding The Path To Apache Httpd.h
I've installed Apache 1.3.36 on my Redhat EL 3 machine. Now I'm trying
to install PHP 5.1.4. I can not get the ./configure command to work. I
keep getting this error:

configure: error: Invalid Apache directory - unable to find httpd.h
under /usr/local/apache/include

So then I run this command:

find / -name httpd.h

which should find every file on my machine with the name "httpd.h".
These are the results I get:

/usr/local/apache/include/httpd.h
/home/shelley/apache_1.3.36/src/include/httpd.h

So I've rerun the ./configure command, using this first:

--with-apache=/usr/local/apche/include

and since that didn't work:

--with-apache=/home/shelley/apache_1.3.36/src/include/httpd.h

but I get the "Invalid directory" error with both addresses.

"failed To Open Stream No Such Directory Or File" Apache Suse 10.0
<<"failed to open stream no such directory or file>>

Avez vous trouve ? J'ai le meme genre de probleme en essayant
d'installer en local avec SuSE 10 apache2 php4 , il me semble qu'il
manque un package mais lequel ?

Quote:

"copy()" Function Not Working With File Upload
Below is a multiple-file upload script. The form input part works ok. The variables $FileType, $FileName, $FileSize, $TempName, and $FileError work fine. But just after $FileError (which does not output an error message) the script just stops. The problem appears to be with the "copy()" function. I can simplify the script, make it just a single file upload script, use the variable $userfile for the first part of the "copy() function, and it uploads the file just fine.

The problem is when I try to make it a multiple-file upload script like the one below - then the copy function won't work.

I would appreciate if anyone could spot the problem.

PHP Code:

$Admin[UploadNum] = "10";
if($FileUpload) {
for ($Number = 1; $Number <= $Admin[UploadNum]; $Number++){
if ($FileUpload) {
$FileType = $_FILES["userfile"."$Number"]["type"];
$FileName = $_FILES["userfile"."$Number"]["name"];
$FileSize = $_FILES["userfile"."$Number"]["size"];
$TempName = $_FILES["userfile"."$Number"]["tmp_name"];
$FileError = $_FILES["userfile"."$Number"]["error"];
echo "File Type: $FileType<p>"; // $FileType prints out fine.
echo "File Name: $FileName<p>
"; // $FileName prints out fine.
echo "File Size: $FileSize<p>
"; // $FileSize prints out fine.
echo "Temporary Name: $TempName<p>
"; // $TempName prints out fine.
echo "Error Message: $FileError<p>
"; // Does not output error message - appears to work fine.
// ------------ The script stops working right here ------------
if (copy ($_FILES['userfile'.'$Number']['name'], "users/".$_FILES["userfile"."$Number"]["name"]."")) {
    echo "Your file was successfully uploaded!<p>
";
} else {
    echo "Your file could not be copied.<p>
";
}
}
}
unlink ($userfile);
}else{
echo "<form action="$PHP_SELF" enctype="multipart/form-data" method="post">
";
for ($Number = 1; $Number <= $Admin[UploadNum]; $Number++){
echo "<input name="userfile"."$Number" type="file" size="25">
";    
}
echo "<input name="FileUpload" type="submit" value="Upload Files"></form>
";
}

Value Of Variable Shown As "Array" When From Included File
I have this statement to find the latest date that a row was inserted
________

$entry=mysql_query("SELECT contact FROM board ORDER BY contact DESC
LIMIT 1")or die ("Query failed:<br>$entry<br>Error: " . mysql_error());

while($myrow=mysql_fetch_array($entry)){
if (ISSET($myrow['contact'])){
$latest = date("d M y", ($myrow['contact']+50400));
}
}
________

This reports the value for $latest correctly if the statement is in the
document.

However when the statement is in an included file the reported value for
$latest is ... Array

Where am I going wrong?

Warning: File("") - Inappropriate Ioctl For Device In
any one come accross the following:-

Warning: file("") - Inappropriate ioctl ......

Wile trying to read in a file using file();

Include("....file.php") Doesn't Work (error 2039)
I have a problem with include. I am develloping a site www.mobiclips.net.
I have placed the php files dealing with the gui, getting the pictures and the
download all in seperate folders in the root. Now I want to include the header an db.php,which are in the root. I have to use something like this <?php
include("....dbconnect.php")since I grouped all php related to each other in one map which itsel is in the map called PHP.

It works fine on XP amd windows 2003, but it does not work on the webserver on
linux. Notthing shows up. A few test showed that .. go up a level doesn't work.
When I put Echo ERROR_ALL I get error 2039 ...

Type Casting To Float To "ensure Reliable Comparison" ?
Web Database Application with PHP
and MySQL, 2nd ed.

on chapter 9 the author give an example for age validation :
(simplified code, not a direct quote)

$dob = mktime(0,0,0, 5, 3, 1983);

if ((float)$dob > (float)strtotime("-18years"))
{
print "....";
return false;
}

my question is why the type casting to float ?
after all the return type of both mktime & strtotime is int, why the
need to cast to float?
the authors emphasize this in the explanation section by "We use the
mktime() function to convert the date of birth to a large numeric Unix
timestamp value, and the strtotime() function to discover the timestamp
of exactly 18 ago. *Both are cast to a large floating number to ensure
reliable comparison...*

Upload File Error 3: "The Uploaded File Was Only Partially Uploaded"
I've a file that starts like this:

<form id="pdsForm" method="post" action="/mcControlPanel.php"
class="mcForm" charset="UTF-8" enctype="multipart/form-data" >

and it contains this input:

<input id="biopic" name="biopic" type="file" />

The script recieving it does this:

$biopic = $this->core->getVar("biopic");
if (is_array($biopic)) {
print_r($biopic);

I get:

Array ( [name] =L-monkeySmall.jpg [type] =[tmp_name] =[error] =>
3 [size] =0 )

Error 3 is "Array ( [name] =L-monkeySmall.jpg [type] =[tmp_name]
=[error] =3 [size] =0 )". As you can see, 0 kilobytes were
uploaded.

What should I look for? I've been looking on the web for awhile and so
far I've found little useful information about what Error 3 typically
indicates.

Configuring Php "session.path" On Win2k
I did some messing with php and attempted to install osCommerce, it started crashing apache so I uninstalled php, and apache and now sessions dont work at all. here is my php.ini file Code:

"include Path" Doesn't Function The Way I Thought It Would
I have a PHP script that resides in a public directory. The real directory is something like this (directory names changed but nesting level holds true):

/usr/top/public/the-script.php

This is the path that is shown if I print __FILE__. I have an include directory that lives here:

/usr/top/hidden

I do the following with ini_set:

ini_set("include_path", ".;/usr/top/hidden");

However if I try to include a file that resides in /usr/top/hidden using just the file name:

require_once("file-in-hidden-dir.php");

I get a fatal error saying the file could not be found, with the include path I set showing in the error dump as the correct include_path.

If I try opening up the file using an explicit full path declaration:

require_once("/usr/top/hidden/file-in-hidden-dir.php");

It opens without error. What could I be doing wrong to have this problem?

How Do I Figure Out The "full Path" To My Directory
I'm running a script at the moment that requires the full path to my directory.

How do I figure this out?

Catching "File Name Too Long" Errors
Is there a way to redirect on "file name too long" errors?

I'm using mod_rewrite to handle all unknown urls with an error page.
That's not working for this error. Apparently the "file name too long"
error occurs before mod_rewrite is invoked.

Setting up an ErrorDocument is also ignored, even though it looks to the
user (and listed in access.log) as a 403 error, it's not a normal 403
error.

Saving An Image From A "file" Form?
How do I recieve a picture from a form off a website and save it to a directory? I use the "file" form to allow the user to browse their local drive but how do I get the actual picture so I couild use it later?

Calling "php -f [file]" From Within Perl Seems Broken
I've recently decided to switch from compiled Apache/PHP to RPM's of
both and I'm having a problem I can't seem to solve. I have a Perl
script called php_include.cgi that parses a PHP file for inclusion. It
does this by running "php -f [php include file]" but unfortunately it
no longer works with the RPM:

----------

Security Alert! The PHP CGI cannot be accessed directly.
This PHP CGI binary was compiled with force-cgi-redirect enabled. This
means that a page will only be served up if the REDIRECT_STATUS CGI
variable is set, e.g. via an Apache Action directive.

For more information as to why this behaviour exists, see the manual
page for CGI security.

For more information about changing this behaviour or re-enabling this
webserver, consult the installation file that came with this
distribution, or visit the manual page.

----------

The RPM for PHP obviously compiles with --enable-force-cgi-redirect.
If I either set cgi.force_redirect = 0 in php.ini or set
$ENV{REDIRECT_STATUS}="200"; in my Perl script, this error goes away,
as expected.

The weird part is that I do something like this in my Perl:

print `/usr/bin/php -f /var/www/html/includes/footer.php`;

Which you would expect to parse and output footer.php. Oddly, it
prints the contents of php_include.cgi (the calling Perl script)
instead! If I run the exact same command in a shell (even as my apache
user) it works correctly. When called from the web, it displays the
Perl script, not the php.

I've confirmed this a bunch of different ways.

Yes, I know I could blame this on the RPM, but I'd like to move to a
"standardized" load if possible... Makes updates easier... Also, this
one's got my curiosity...

How To Delete A "readonly" File In Windows?
Got the following problem: PHP has no problem with deleting an ordinary file, but when it is marked as "Read-Only", I get such an error: Warning: unlink(Z:/home/localhost/www/***.html) [function.unlink]: Permission denied in z:homelocalhostwwwoddik est.php on line 45.

Passing Var With A Form "select" Type
i need to pass the choice of a form select to a page the form posts to "alllinks.php"

<form name="viewby" method="post" action="alllinks.php">

i want to send a value that i can pick up as $admin_userid on the next page, is this correct for sending it?

<option name="admin_userid">1</option>

bit confused, i've done this before with "text" types but a select seems to be more confusing?

Checking "last Updated" On Remote Files.
How do I check the last updated time on remote files. I'd like my end result to be, a function that takes a list of urls, check the lastupdated date on that file (i.e., home page of someone's blog), so I can then grab the ten most recently updated among them, and print them, in descending order of update date.

How Do I Do Something Like $color = ("red", "yellow", "blue")[$colornum]?
How do I take an index of a literal array, instead of a variable?

That is, say I want to get the short name of a month. Can I do
something like:

$monthname = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec")[$month];

or do I always have to do:

$blah = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec");
$monthname = $blah[$month];

It seems a shame to have to create a variable specifically for this
one-shot purpose.

"not A Valid JPEG File"
I am trying to upload an image to a server, but I get this warning:

Warning: imagecreatefromjpeg(): 'filename' is not a valid JPEG file

The error occurs when I am trying to create a thumbnail from the image. I
can subsequently display the JPG image itself, but the thumbnail creation
fails. I have tried this with hundreds of other images from the same source
and they work fine.

I have looked around on Google and it seems that others have had this same
problem, but I have not been able to find a solution.

Is this a PHP bug? Is there a workaround? Should I just trap the warning
and tell the user (my users will upload their own images) that the file is
not valid? They will surely question this, because seemingly every other
image displayer has no trouble with it.

Reading A "live" Log File?
I have come across a situation where it would be useful to read new lines being added to a log file on the users system. I have never seen anything like this discussed before so was curious if anyone had any prior experience with something of this nature. I am familiar with reading and writing to text files but not in real-time constantly.

Writing "quotes" To A File...
I am currently working on right now requires me to output quotes into a text document.
How could I go about outputting quotes? (If i add quotes it finds it to be part of the syntax..I have something similar to this: PHP Code:

File Uploading; "image/jpg"
I've created a file upload for images, and would like to duplicate one for other files that do not include images, with limitations (i.e., I don't want people uploading .exes, .ppts, etc).

Is there a list of all of the file types and extensions?

Y'know, like "image/jpg", "image/png", etc?

The reason I'm asking is because I'm not sure what I should type before "/ext" ("movie/wmv"?), Word document ("word/doc"?), or other files.

Input Type = File
If an input field of type 'file' is left blank, what is returned as the varible? I'm having a problem, I have two file fields and want to be able to do the following:

1. Put in the $file1_name and $file2_name (if there was a file uploaded) into a database so I can reference it later.

2. Copy the uploaded file (if, in fact, there was a new one uploaded) to a directory.

3. Later on, if someone wants to edit that entry and wants to upload a new file for the 2nd slot, or 1st for that matter or delete a file, it should do that with no difficulty.
I'm running into problems when it reaches the 'if' clause. I've tried:

if ($var){
and
if($var != ''){

and no matter what, for some reason these blank file fields alwasy evaluate true to my if statements, so I get an error like 'can't open file 'none' for blah blah'.

Getting The File Path From A Html Form Input
I want to get the file path from a file input field, not just the filename. I don't have to necesarily use the input of type 'file', but that is the only way i know how to have a browse button.I tried using javascript to fetch the content of the file with this function:

function GetDirectory(){
   strFile = document.FileForm.filename.value;
   intPos = strFile.lastIndexOf("");
   strDirectory = strFile.substring(0, intPos);
   alert(strDirectory);}

but i don't know how to pass the javascript variable to the php.

Purpose Of A ".inc" File?
If a file has a .inc extension, or if it has a .inc.php extension, is it
treated differently by the php interpreter? Or is it just a convention?

I've been calling my included files filename.php and it doesn't seem to
hurt anything. Is it wrong to do that?

Removing " ^@ " From A File
I have a file on my Linux box that has this strange control character
combination (^@) in it at the beginning of every line. I can only
remove this from VI. I have tried using sed, tr, and others to remove
it, but none work. How can I remove this control character sequence
via PHP??

^@^@
^@^@ DPCA ALIASI ALIASN/N24 CLLI LSN RC
APCA
^@^@ 208-000-000 ------- ----------- alias208000 bi403239 0
208-001-000
^@^@ bi403240 0
208-002-000
^@^@ cc403000 10
235-002-000
^@^@ 235-243-002 ------- ----------- ----------- bn403131 0
235-007-000
^@^@ bn403132 0
235-006-000
^@^@ cc403000 2
235-002-000
^@^@ 226-251-070 ------- ----------- vancbcxpgt0 bm403044 0
226-008-000

Strip "-" Out Of File Name?
How do I strip out the - in a file name and add a space in its place? example:

123-456.php I want it to print on a browser as: 123 456

echo "<a href="$PHP_SELF/articles/credit_repair/$filename" target="_BLANK">".substr($filename,0,strlen($filename)-4)."</a> | ";

Preventing Visitors Ability To "re-visit" A Page Via The "back Button"..
I have a rather complex registration/member sign up form.. which gets a little confused, when a visitor "backs" completely out of the form, then for whatever reason returns to the form. The form contains 'cancel' buttons, which naturally cancel the reg process and redirects them to the document just before they started.

JS provides us with the "location.replace()" method, but I can't seem to find a way to coordinate the use of location.replace() with the posting of the form values. In short, I want to "replace" the first step of the form with the "second step".

I think what's making this tricky, is that each step of the form are located within the "same" page (register.php). The document works like so: The first step is the "Member Agreement" when they click "agree" (submit) the system creates a new row in the temporary register table of the db.

It then issues a registration cookie, which carries the row id, and session value. in addition (for those cookie impared users) we carry the row id and session value in hidden elements. So far, as long as the user continues through the process all is fine, but if they (for whatever reason) back all the way out, and click 'agree' again, the process fails.

I guess I have to find a way to force a reload of the 1st step "if they've gone back" OR "replace()" the first step with the second, so as to prevent the user from going "back" to the 1st step of the register page.

Imagejpeg Generating String Not Image Even With Header("Content-type:image/jpeg")
does anyone know why i can't generate images with:
header("Content-type:image/jpeg");
imagejpeg($img_number);

i've tried different examples but i always get a text output as if the
header doesn't make a difference at all.

<?php
//random_number.php
$img_number = imagecreate(100,50);
$white = imagecolorallocate($img_number,255,255,255);
$black = imagecolorallocate($img_number,0,0,0);
$grey_shade = imagecolorallocate($img_number,204,204,204);

imagefill($img_number,0,0,$grey_shade);
ImageRectangle($img_number,5,5,94,44,$black);
ImageRectangle($img_number,0,0,99,49,$black);

header("Content-type:image/jpeg");
imagejpeg($img_number);
?>

Errors Won't Show Up Even With Error_reporting(E_ALL) And Ini_set("display_errors","1")
Here's my code:

<?php

error_reporting(E_ALL);
ini_set("display_startup_errors","1");
ini_set("display_errors","1");

wefw
wefwef=wefwe
2349023909()
;wrgwrg ====232

phpinfo(); ?>

I get a blank page.

If I take out the crap, it prints phpinfo() just fine.

PHP 4.3.something...

Pagnation - Limit Number Of Pages Between "Previous" & "Next" Hyperlinks
Was hoping for some advice with a part of page navigation....

It works at the moment so there is a "Previous" & "Next" Hyperlink underneath the records. In between the Previous & Next links are the number of pages that there is of these records. e.g:

Previous 1234 Next

This is fine if there are only a few pages of records, but when there are hundreds of pages the numbers are listed and they take up half the web page with them.

How can i make it so only limited 10 numbers of pages say appear between the "Previous" & "Next" Hyperlink and as you progress through the pages they are as do the next 10 numbers of pages? Code:

[regex] Stripping Out "name" And "value" Values Out Of Tags, Aaargh
Searched through the site, but couldn't find the right regex syntax I was looking for.

the thing i want is, to extract with preg_match_all the given values in a tag...

ex.

$str = '<input type="text" name="name" value="value">'
$pattern = some magic stuff I need to know
preg_match_all($pattern, $str, $result);

And in result I want to have the values text, name and value AND it's important that the order doesn't matter
so structure of tags can be <input type =name= value=> or <input name= class= value= type=> etc, etc...

Group Mailing, Want To Suppress All The "to" Addresses In The "to:" Field
I want to do a mass emailing for a club.
I don't want all the clubs members to see all the addresses of the
other club members for privacy reasons.

How do I set up the php mail function to not display the recipients
email addresses, just to display something like, "U7 Soccer Club
Team"?

'Parse Error' Problem In "isset" And "empty"
I've been having some problems with a parse error that I can't figure
out (PHP 4.3.11 on Solaris9). Sample code:

<?php
// getting strange parse errors on this
class A {
var $value;
function A() {
$this->value = 1;
}

function getValue() {
return $this->value;
}
}

$a = new A();
if (!empty($a->getValue())) {
echo "success";
}
else {
echo "failure";
}
?>

The result of this is:

Parse error: parse error, unexpected '(', expecting ')' in
/foo/public_html/parse_errors.php on line 15

I also get the same effect with "isset", however, testing with "is_null"
or "is_int" produces the correct ("success"/"failure") result. Any ideas?

How To Do PHP "require()" Or TCL "source" In Bash Script
I can't figure out how to explain this any better than
this.

In PHP we have a command "require()" that obtains a file and logically
places it into another file.

I cannot figure out how to do this in bash script as the requirement
is necessary for a migration script to obtain the code from a .cfg
file and then be able for the "parent" script to run the code it
"imported" from the .cfg file, much like PHP's require() or TCL's
"source".

This is what I have so far and it fails:

if [ -f ivc.cfg ]; then
cat ivc.cfg
fi

Anyone really know bash script well please help, it's a barrier for me
not to be able to get just this one piece working.

Error In Page When Checking Http_get_vars("myvar") And "myvar" Was Not Passed In URL String
PHP, coming from ASP coding

if (HTTP_GET_VARS['b']==1){
print "Yes";
}else{
print "No";
}

when "b" is not passed via
(http://www.mydomain.com?b=1

an error occurs and the "NO" is printed but an error is printed too.

How can I check for the value of "b" so that no error occurs if b is
not passed??

example

http=www.mydomain.com

$myvar=HTTP_GET_VARS['b']

causes an error because
"b" does not exist (ie. its not passed in the URL string.

$myvar maybe evaluated as NULL or Empty but the error is printed in
the page, anyway.

"<td><input Name='".$i-2."'
I am traing to output the following HTML string from PHP:
"<td><input name='".$i-2."' size=&#392;' type='text'
onBlur='myfunction(".$i-2.")'></td>"
But it somehow mistreats $i-2. PHP does not throw any errors but the
browser renders the table incorrectly.
I got round this by introducing another variable
j=i-2 and using it in place of i-2
It works. However I am interested to understand why is does not work with


Copyright © 2005-08 www.BigResource.com, All rights reserved