SRL Archive - Web Development

php and a little html help


grats

2011-08-14 09:23:06

ok, how would I make the form bigger? like the whole text box..


<html>
<body>
<br/>
<form name="contact" method="post" action="/scripts/contacts.php">
Please leave contact information if you want to be responded to...
<br/>
<input type="text" name="name" />
<input type="submit" value="Send"/>

</form>
</body>
</html>



I tried searching for a way to do a form in css but I couldn't find it -.-

[PHP]<?php
$name= $_POST["name"];
echo "status: ".$name;

$name_file = 'messages.txt';
$content= $name;
fopen($name_file, 'a+');


if (is_writable($name_file)) {


if (!$manager = fopen($name_file, 'a')) {
echo "We can't open ($name_file)";
exit;
}


if (fwrite($manager, $content) === FALSE) {
echo "We can't write to file ($name_file)";
exit;
}

echo " / Successfully sent. ";

fclose($manager);

} else {
echo "We can't write to $name_file";
}
?>
[/PHP]

and my php question, right now it rights to my .txt file which is cool, is there a way to maybe have it go down two lines for every separate message?

if not is there a way to save a different .txt per message.. like in a messages folder or something? it would have to be creating the .txt then too, instead of just writing to the .txt which I am not sure how to do at all

thanks for help

Shuttleu

2011-08-14 09:24:37

im sure with input tags you can use
Width="" and Height=""
or
Length=""

~shut

grats

2011-08-14 09:29:16

From: Shuttleu
im sure with input tags you can use
Width="" and Height=""
or
Length=""

~shut


yea I don't know why it doesn't work

didn't think of length but that didn't work either

you're saying like:

<form name="contact" width="1000" method="post" action="/scripts/contacts.php">

and stuff right?



edit:

and yea I've tried in the input tags, creating new etc

but that'll just make another box which allows me to do nothing lol and it is no bigger, even if I put it at like ="100000"

Shuttleu

2011-08-14 09:34:01

no i mean for the input fields

try using
<textarea rows="10" cols="30" name="name"></textarea>
instead

~shut

grats

2011-08-14 09:41:57

it worked as a box but the send wouldn't accept any text in it

Shuttleu

2011-08-14 09:45:30

what do you mean?
$_POST['name'] always returned nothing?

~shut

grats

2011-08-14 09:48:30

From: Shuttleu
what do you mean?
$_POST['name'] always returned nothing?

~shut




whatever I post in the top box and click "send"

then I see it in my messages.txt


but anything in the bottom text area one I don't see

the php says it successfully sent it, which means it just doesn't see anything in the text area.. so it writes nothing



nvm now it just worked I didn't change anything lol

about time it worked -.-


now do you know a way to make it put a return(enter) when a new message comes?

Shuttleu

2011-08-14 09:51:13

i think its chr(27)

~shut

EDIT: i mean chr(13)

EDIT: tehehe
program new;
var
aClient: Integer;
begin
repeat
aClient:= InitializeHTTPClient(True);
AddPostVariable(aClient, 'name', 'Spammy time');
PostHTTPPageEx(aClient, 'http://greggrats.com/scripts/contacts.php');
FreeHTTPClient(aClient);
Wait(1000);
until(False);
end.

grats

2011-08-14 10:00:35

From: Shuttleu
i think its chr(27)

~shut

EDIT: i mean chr(13)

EDIT: tehehe
program new;
var
aClient: Integer;
begin
repeat
aClient:= InitializeHTTPClient(True);
AddPostVariable(aClient, 'name', 'Spammy time');
PostHTTPPageEx(aClient, '/scripts/contacts.php');
Wait(1000);
until(IsFKeyDown(12));
end.


lol!! don't kill me =[

how do I make it press down a character (enter) when it does the input stuff?

I figured this php out from a bit of w3 and from my upload php script I did a while ago, I don't really know what I'm doing lol

Shuttleu

2011-08-14 10:03:05

i dont quite understand what you mean

~shut

grats

2011-08-14 10:05:02

you said it was "chr(13)" ? that's character 13 or something I think?

how would I make the php script do that whenever someone presses the send button



so it doesn't look like this:


Shuttleu

2011-08-14 10:07:27

you mean add that to the file?

[php]if (fwrite($manager, $content.chr(13)) === FALSE) {[/php]

grats

2011-08-14 10:12:08

From: Shuttleu
you mean add that to the file?

[php]if (fwrite($manager, $content.chr(13)) === FALSE) {[/php]


yay it works!

also one problem now, it says everything twice lol



nvm fixed it


thanks a bunch for your help, sorry I suck lol

Shuttleu

2011-08-14 10:15:21

lol

not sure why

im assuming your code now looks like this
[php]<?php
$name= $_POST["name"];
echo "status: ".$name;

$name_file = 'messages.txt';
$content= $name;
fopen($name_file, 'a+');


if (is_writable($name_file)) {


if (!$manager = fopen($name_file, 'a')) {
echo "We can't open ($name_file)";
exit;
}


if (fwrite($manager, $content.chr(13)) === FALSE) {
echo "We can't write to file ($name_file)";
exit;
}

echo " / Successfully sent. ";

fclose($manager);

} else {
echo "We can't write to $name_file";
}
?>[/php]

grats

2011-08-14 10:17:17

yea I had two of the same if statements rofl, didn't see it at first

thanks for all the help