Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

90 users online



Varibles inside Varibles

Varibles inside Varibles

Currently viewing this thread: 1 (0 members and 1 guests)


Page 3 out of 4
BigToach

BigToach

Neversidian
Status: Offline!

you need to use a wyiswyg editor and get rid of the one that you are using right now.
and yeah i really really miss the double click copy, and the old php syntax where one line was really one line, not this double spacing crap. however the new quickedit and a few other little gems definately make up for it for the time being

___________________

Neverside Development Director
PHP Snippets
BigToach.com - IT WORKS, TOACHY!

evan

evan

Neverside Newbie
Status: Offline!

Triple click the text area you want to copy, then right click, copy.

EDIT: Nevermind, that only select one line, not multiple lines Sad

Phil

Phil

with Mr. Jones
Status: Offline!

When it "doesn't work" do you get any errors? use error_reporting('E_ALL');

___________________

http://www.philbrodeur.com - Expert PHP Development and Tutorials

Rovman

Rovman

Status: Offline!

add.htm:

PHP:

<?php
<body>

<
form method="post" action="fwrite.php">
<
p>Name: <input type="text" name="name" /></p>
<
p>Comment: <input type="text" name="comment" /></p>
<
input type="submit" value="Add your Comment" />
</
form>
</
body>
?>

fwrite.php:

PHP:

<?php
$filename 
"halo2.txt";
$name = isset( $_POST['name'] );
$comment = isset( $_POST['comment'] );
$somecontent $name ." - "$comment;
if ( 
is_writable$filename ) ) {
   if ( !
$handle fopen$filename'a' ) ) {
    echo 
"Cannot open file "$filename;
    exit;
  }
  if ( !
fwrite$handle$somecontent ) ) {
    echo 
"Cannot write to file ".$filename;
    exit;
  }
  echo 
"Success, wrote ".$somecontent." to file ".$filename;
  
fclose$handle );
} else {
  echo 
"The file ".$filename." is not writable.";
}
?>

That works, but when it adds to the file, it appends directly after the last comment. Also i have removed all your error checking. You can sort out that stuff yourself Smile

___________________

~rovman

Motorspin

Motorspin

Neverside Newbie
Status: Offline!

The reason it's appending is because you set the file open mode that way. fopen( $filename, 'a' )
a = append.

You should always use error_reporting('E_ALL') on all your stuff, just do yourself a favor and use it. Smile

___________________

Travis Farrell
http://motorspin.com/stuff/images/avasig/m_enterprisesig.gif

Ron

Ron

Status: Offline!
Quote:

Originally posted by Motorspin
You use to be able to double click on the code and it'd copy to your clipboard but I don't know where that went. Sad


sorry to jump in here but, I just double clicked and it copied the code(s) for me Wink

Phil

Phil

with Mr. Jones
Status: Offline!
Quote:

Originally posted by Ron
sorry to jump in here but, I just double clicked and it copied the code(s) for me Wink

Its working on a per skin basis i think

___________________

http://www.philbrodeur.com - Expert PHP Development and Tutorials

KoolAsIce

KoolAsIce

Status: Offline!

Rovman's script dos'nt work (it's uploaded) but it does exactly the same as the others, it come up as a blank source (which is what is expected) but there is nothing added to the halo2.txt file. :confused:

My original script worked perfectly if I did'nt get varibles form the url and used the same scentance every time but it was when I added these varibles in that I ran into problems

Is there any way I can make the php script get the varibles from the URL (using $_GET['name'] and/or $_POST['name']) before thae script processes the writef command?

I've tryed these:

PHP:


<?php

$filename_
=_'halo2.txt';

// I've changed this line
$name_=_"$_GET['name']";
$comment_=_"$_GET['comment']/n";

if_(is_writable($filename))_{

____if_(!$handle_=_fopen($filename,_'a'))_{

_________print_"Cannot_open_file_($filename)";

_________exit;

____}

// Iand this one
____if_(!fwrite($handle,_$name $comment))_{

________print_"Cannot_write_to_file_($filename)";

________exit;

____}

____

____print_
"Success,_wrote_($somecontent)_to_file_($filename)";

____

____fclose
($handle);

____________________

}_else_{

____print_"The_file_$filename_is_not_writable";

}

?>

and:

PHP:

<?php

//I've changed the 
$_GET /* to */ $_POST
// (and in the form) but it still dos'nt work help

?>

::jaguar::

___________________

http://80.255.219.99/~Scott/signature.gif

KoolAsIce

KoolAsIce

Status: Offline!

without the underlines of course (just ignore them iv'e got mac os 9 and it's not so great at some things!) oh but the servers not so don't

oh and whats error_reporting('E_ALL')?

___________________

http://80.255.219.99/~Scott/signature.gif

Last edited by KoolAsIce, October 10th, 2003 02:28 PM (Edited 1 times)

Jeremie

Jeremie

Neversidian
Status: Offline!
Quote:

Originally posted by Ares
When it "doesn't work" do you get any errors? use error_reporting('E_ALL');


Btw ares, E_ALL is a constant, you dont need to send it as a string to error_reporting()

just error_reporting(E_ALL); will work

$name_=_"$_GET['name']";
WHY DO YOU PUT THE VARIABLE IN A STRING?!?!?!
Arrgh!

i posted the good script to grab the value

___________________

Jeremie - Used to be the Director of Community Development

Page 3 out of 4
Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0108 seconds.