$help

liunx

Guest
Hi,

I got a little problem i want people to be able submit a text box. but i want the text the person entered to be broken up with <br>

example:

name="text"
BLA BLA BLA BLA
BLA BLA BLA BLA

// equals

$text = $HTTP_GET_VARS['BLA BLA BLA BLA BLA BLA']

// once submitted comes up
BLA BLA BLA BLA BLA BLA BLA BLA

// i want it to come up
BLA BLA BLA BLA<br>
BLA BLA BLA BLA<br>

I also want to replace strings of text submitted from a text box.
example:

// replace this
(pic1.jpg)
// with this
<img src=http://www.htmlforums.com/archive/index.php/"pic1.jpg">$text = str_replace("\r\n", "<br />", $text);Originally posted by blind--angel

name="text"
BLA BLA BLA BLA
BLA BLA BLA BLA

// equals

$text = $HTTP_GET_VARS['BLA BLA BLA BLA BLA BLA']

I also want to replace strings of text submitted from a text box.
example:

// replace this
(pic1.jpg)
// with this
<img src=http://www.htmlforums.com/archive/index.php/"pic1.jpg">
first just so you know,

this
name="text"
BLA BLA BLA BLA
BLA BLA BLA BLA

will never equal this
$text = $HTTP_GET_VARS['BLA BLA BLA BLA BLA BLA']

it will equal this
$text = $HTTP_GET_VARS['text']

and $text will equal BLA BLA BLA BLA BLA BLA

so along with what N8 said I would do this
$text= ereg_replace("(\r\n|\n|\r)", "<br />", $text);
as it is just a littel faster than what he posted and covers more.

now to answer your other question

// replace this
(pic1.jpg)
// with this
<img src=http://www.htmlforums.com/archive/index.php/"pic1.jpg">

if you allow uploading then you would need to store the images in a folder. after you store the image in that folder you need to get it and just insert it into the img tag. no need to replace anything there. so you have to search the folder for the image you want than just insert it in to the img tag.ok... the full story(short version)

i need to make a 'submit a tutorial' page which allows them to submit a tutorial with pictures... and i want it so if they type (pic1) in the textbox where they submit it will come up on the html document it produces. (the picture is uploaded in a seperate input file.

I hope under stand what i mean.ok now that opens up another question. what kind of database are you using? because you have to use one if it has to remember what to place where.

suppose you don't have to use one if you have it coded in the script depending on the user, that it will look for the users folder and finds the pic that you need. if it is random you can't do it.

I understand what you want but depending on how you go about it is the question.mysql... i want it to open the last entry in the mysql db and find out what id it was... then it will +1 and create a new directory with name (highest id +1). it will then do the same with a php document. and will save both the documet and images into the new directory.for getting user input on diff lines as entered by user, use nl2br()
<!-- m --><a class="postlink" href="http://www.php.net/manual/en/function.nl2br.php">http://www.php.net/manual/en/function.nl2br.php</a><!-- m -->
for getting last inserted id use mysql_insert_id
<!-- m --><a class="postlink" href="http://www.php.net/manual/en/function.mysql-insert-id.php">http://www.php.net/manual/en/function.m ... ert-id.php</a><!-- m -->

tontothanks for the help tonto i'll keep that in mind although that may not be exactly what i'm looking for but then again it might be. what about the other stuff.
 
Back
Top