FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


html form help needed





nunosilva
probably it's a simple question but here it goes...
I'd like to make on a form a textbox that will serve as a comment of photos that are inserted.
I've got on the form:

<input type=text size=255>

but this gives me a horizonally huge textbox... not what I want. I want something just like this text box that we use to post questions! Very Happy

can anyone tell me how?

Thanks in advance

Nuno
littlegiant
You could use <textarea>...</textarea> instead and control the dimensions using the rows and cols attributes. Example:

<textarea
rows="15" cols="50" name="comments">
</textarea>
nunosilva
yes, I see that. I've tried but that won't do in the form...
Aelita
i dony't know what you want..I would have given little giants response but here anyway..
Code:
<textarea name="textarea"></textarea>


<input type="text" name="textfield">

try those I guess.
Theres two different examples there
nunosilva
I tried it... doesn't work on mysql... the textarea is with the name that the input text you wrote, and still not working...
or it isn't working well in the mysql....
mathiaus
What you want is a textarea which is created using the codes already provided. What you mean when you say it doesn't work, I'm not eactly sure though.

If you provide us with some scripts, links and error messages we'll be able to help mutch better Wink
nunosilva
Code:



<form enctype="multipart/form-data" action="filesent.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="3000000" >
Send this file: <input name="userfile" type="file">
<textarea name="coment" rows="10" cols="40">
</textarea>
<input type="submit" value="Send File" >
</form>


Code:

$ligacao = mysql_connect("localhost","rantanplan","rantanplan") or die("Problemas de ligacao");
mysql_select_db("homesite",$ligacao);
$sql = "INSERT INTO `photos` (`username` , `link` , `coment`) VALUES
($username,$link,$coment)";
mysql_query($sql);


I have this... if I had the input type=text... it would work perfectly... with text area... not working...
nunosilva
anyone that want to help, on the last post, I said I was using textarea... I tried putting id=coment but didn't work as well.... any ideas?
mathiaus
Try adding this before you insert it into the database

Code:
$coment = $_POST['coment'];
nunosilva
I can do that and it works perfectly if I want to echo it to the page... I have that var in the sql code to insert the text but it doesn't want to... but if i use in the form <input type=text...> instead of the <textarea> it put's with no problem the var contents in the table...
JayBee
I thing, there could be a problem with sql query. You'd like to add qoutes to update command like
Code:

$sql = "INSERT INTO `photos` (`username` , `link` , `coment`) VALUES
($username,$link,\"$coment\")";


I thing, it could solve some problems.
mathiaus
I've been picky with you code and changed a few things such as the free spaces at the end of some form fields and some general syntax. Please try these two bits of code and see if they work.

Code:
<form enctype="multipart/form-data" action="filesent.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="3000000">
Send this file: <input name="userfile" type="file">
<textarea name="coment" rows="10" cols="40"></textarea>
<input type="submit" value="Send File">
</form>


Code:

$ligacao = mysql_connect("localhost","rantanplan","rantanplan") or die("Problemas de ligacao");
mysql_select_db("homesite", $ligacao);
$sql = "INSERT INTO photos(username, link, coment) VALUES
('$username', '$link', '$coment')";
mysql_query($sql);


Of course you'll need to change the username, password and databse name! Smile
nunosilva
mathiaus, that worked... loool
I had a slight problem with my server's security 'cause it didn't allowed me to upload files, but it had nothing to do with that. Apart of that, it's working now, and that's prety fine!

thanks a lot.
Related topics
Help Needed Regarding CGI And Php
HTML help needed
Wordpess help needed.
Please help me!!!! HTML/Flash help needed!
Help needed :P
HTML form, list of options or text input
Send Mail HTML Form
Help needed about this contact CGI file
Uplaoding images using php form :::: Help needed
Assign unique rank in html form using javascript possibly?
Big Help needed .
Html Forms help please?
Help needed with getting table to auto update via html form
upload file to server using html form and CGI C
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.