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




Click Button And Adds To Text Area - Like SMF Bbcode


How can I make buttons to add some things to a text area, like the bbcode for SMF?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Form Button Click Itself.
is it possible that  on a php script that i can make the form button click itself.

so i have a button that when a certain argument happens i want to click on itself thus resetting itself and doing the php script associated with the button being clicked the php is on a form on php self.  know it sounds strange but i have some coding that needs to reset itself and only does that when the button is clicked just want a work around. failing that is it possible to use jave to achive this.

Open Window On Button Click
in a form, here's what I want to do :

<input type=button onclick= (???)

is it possible to open a pop-up window with a specified url without
using javascript ?

C Alling A Function With A Button Click
im relativly new to PHP but loving it - its fantastic isnt it (reminds me a
lot of BASIC on steroids)

my question is this

how do i call a function from a button using php?

Click A Button To Download A File
i was wondering if this was possible, when a user wants to download a file from my server say: filename.pdf they need to "right click" save as to get it, but i was wondering if there was a way i could have a regular submit button do it for example:

<input type="submit" name="submit" value="Download File" />
once it's clicked it pops up the download box

How To Avoid Multiple Submit Button Click?
i have one form on which the data is stored in database and suppose the
user clicks the back button of browser and again click on submit button
then the data will be saved in database again.

so how can i solve this problem?

Problem Resetting Sessions With Only One Button Click
I am struggling for a solution to clear some fields on my webpage that takes
their values from some sessions
My solution below works when the button is clicked twice. I sort of know why
I have to click it twice to do the job (the first submit resets the sessions
but this it too late to change the field values, which requires another
submit to pick up the new session values). Problem is I cant think how to
accomplish the resetting of the fields to nothing with one click

Code so far(below)
**********************************
<form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF'];
?>">
<input name="Submit" type="submit" value=" Clear ">

<?php
if(isset($_POST['Submit'])){
$_SESSION['savedcomm']=''
$_SESSION['pupilfield']=''
$_SESSION['gender']=''
}
?>

</form>
****************************

Text Area Not Accepting Large Amounts Of Text
I have a form where teachers enter homework assignments and they are then stored in a MYSQL database and retrieved elsewhere.

I have been using "get" with the form. The code is simple:

<textarea name="array[assignment]" cols="60" rows="10" id="array[assignment]"></textarea>

It does allow post of 100 words, etc. Stuff that teachers normally submit.

What's happening is that it won't allow very large posts (over 300 words maybe? ) Not sure what the cut off is. When you press submit it won't go, or there is an error where it won't submit.

Is there a limit for text fields? Since the fields scroll, I didn't think that having only 60 rows was any type of real limit, I though you could put in as much as needed. But then all of it ends up in the address bar, so there must be a limit of some sort.

Loading A Form On Button Click (client-side)
Hi can anyone show me how to load a simple form (i.e. make its contents
visible) on the click of a button (not in that same form).

Right Button Click On Any URL Posts That Url To A Server-side Form
this isn't really a php question.
But php is involved, sort of, and I usually get good
answers here, regardless.

I want to build a browser (perhaps as a firefox plugin)
that, for any right-button click on any url on any page, posts the url
to
a server-side php form, that prompts for additional descriptive
metadata and
then inserts that link into a mysql schema.

I know how to do all the server-side php/mysql stuff, but I don't know
how to connect
any right-click on any url (inside the client) as a post to my
server-side URL.

I can imagine this happening, vaguely, as a firefox plugin mechanism.
Does anybody know of any how-to examples, that do something like this?
Or is there an even easier, pure javascript way to do this?

Remove Bbcode From Text
I have the following code that pulls text and subject from a phpBB database and displays it on the main page of a site. I want to pull the bbcode tags out cause it looks ugly. My question is how would I integrate that in to the code that I have below? Code:

Passing POST Data On Link Click, And Not Form Button
is it possible to send a form data to a page, using a link instead of a button?

id prefer not to have to rely on javascript, so i would like it to be ras html, or the like..

BBCode Parsers And Exporting Text From A DB
I'm currently working on a simple (at least I had hoped) script to pull posts from a single "news" forum from phpbb and importing it on the front page of my site. It works great except for the BBCode issues.

It doesn't keep line breaks (biggest concern) as well as text colors, urls, etc (which was expected).  Talking with a friend, he tells me that I'm going to have to insert some BBCode parser to make things work right.  I have 3 questions regarding this:

1) is that my only answer?

2) should I try to use the phpbb BBCode parser that the forum uses?

3) should I install a custom BBCode parser instead?

I did not want to use a portal because they were just over bloated for what I needed and that was simply the posts from the forum itself w/o all the extras like who's online, last post made on the forums, etc.

Would it just be easier to try to strip down something like EZportal to just the info I need instead of trying to use this custom script?

Parsing Text Links And BBCode At The Same Time
I'm not sure if my subject for this is accurate but here is what I'm trying to do:

I want to be able to parse BB sytle code along with regular text links at the same time within the same string.

Here's what I mean...

I have links in a string that can appear in two forms simultaneously:

1) [ url=http://www.abc.com]abc[/url] (without the space of course)
2) http://www.abc.com

Both need to be converted to HTML links of the form <a href="http://www.abc.com">...</a>

I can do each operation on it's own without any problems but trying to differentiate between bbcode and regular text links is giving me some trouble.

I'm currently using the following code for converting links to HTML which works great for my purposes:

$text = eregi_replace("((ht|f)tp://www.|www.)([a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,4})((/|?)[a-z0-9~#%&/'_+=:?.-]*)*)", "http://www.3", $text);

$text = eregi_replace("((ht|f)tp://)((([a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,4}))|(([0-9]{1,3}.){3}([0-9]{1,3})))((/|?)[a-z0-9~#%&'_+=:?.-]*)*)", "<a href="" target="_blank"></a>", $text);

Is there anyway to modify the above code to exclude all links in bbcode?

Replacing Text For Use In A Text Area...
I have a PHP page that allows a user to preview an email and then send it
if(s)he is happy with it.

Otherwise, they can click on an edit button and edit the text of the
message. The text is then shown in a textarea element.

While in situation A (the preview), a bit of formatting is useful (e.g
<BR>), all of this formatting is a nuisance in the textarea.

Basically, I would like to do the following:
a. replace <BR> with a line break for the textarea
b. get rid of double spaces and tabs before the text is loaded in the
textarea
c. put the <BR>s back in when the user is finished with editing the message.

Is there a way to do this?

Text Area
I have a textarea that the user can put a paragraph of information in it. I am wondering. with my submit button. if there is a way to make the information of that textarea = to a variable. so then it can be used as text.

<textarea name="comments" cols="40" rows="5" value=value="
<?  ?>"</textarea></td><td></td></tr>
<tr><td colspan="2" align="right">

That is what i have for the text area.

Updating A Text Area
I'm writing a sort of mini chatroom. The problem I've run into is that I can't figure out a way of updateing the HTML textarea I am using to display the messages in the chatroom.

I want it to update about every 10 seconds or so. Is there any way of doing this in PHP? I'm willing to try JavaScript too, but I've only just started learning that?

Dynamic Text Area
how do I create a dynamic text area that whenever I select a value from a dropdown list it will automatically fill up the form of my html. the dropdown list contains dynamic values from mysql database. Whenever I click a value, it automatically fills up say for example the name, address, email, etc...

Text Area Input Box With PHP
I have a text area box on one page. PHP sets the information that is inputted into the text area into a variable. When I print this info to the screen via echo, it does't have the line retain the formatting that the user had in the text area. It has no line breaks, it runs everything together.

Bigger Text Area
Is it possible to get a bigger text area? So far I have: PHP Code:

Text Area Spacing...?
I have a form, and it's a text area. If I press enter twice, it makes a double space, but when I press submit, and it changes the page, it does not double space!. How can I make my code translate those "enter button" presses into a new line?

Just in case you need to know, it's writing whats inside the text box into a row in my MySQL Database. So in a way, you could say that when you press the "enter" button, the text area does not take it as a new line. Here is my code:

Hyperlink In Text Area
I have a basic CMS system and the client would like to insert some links in the text area. What would you recommend the best way to do this in a textarea box? There may be several hyperlinks in 1 textarea and some may have none at all.

I assume this would be some sort of javascript code or is there an easier way.

Sizing A Text Area Dynamically
I have several text areas I am putting information from MySQL into. Right now they are 50 characters wide, by 10 rows. I want the number of rows to dynamically size do that the text area is the same size as the length of the data in MySQL.

I've tried all the logic I can think of... taking strlen and dividing it by the width... works great until they use line feeds... if someone puts:

"Hello... thanks."

the character count divided by the width is off. Here is the code I am using: Code:

Keep This Text Area From Being Edited In This Form
I need the textarea so it can not be edited by the user..... how can I hide it and keep it so it can not be changed

<textarea name="body" id="body" cols="50" rows="15">'.$_CONFIG['MAIL_BODY'].'</textarea>

this text area has an email message for my inviter script but I dont want the user to be able to alter the body...

how can this be achieved? I manages to hide the subject by ussing type hidden

but I dont know how to do it with this text area.

Detecting Line Breaks In A Text Area?
This is really frustrating... I have a form in which there is a text area for people to post comments on the site. I'm hoping that people will take the time to fill out reasonable length responses which my spread over two or more paragraphs. My problem lies there; it might spread over two paragraphs...

I know I can use 'special character(s)' which the user can put in that I can then do a ereg_replace() to put the <p> or <br> tags in but I would prefer that they didn't have to... like for instance in this forum

I've tried to see whether there are any line breaks or something in the textarea when a carriage return has been made but I can't seem to pick anything up, has anybody managed to come up with a solution to this?

Filling A Text Area With Options From A Select Tag
I read a ACCESS db table and the values from one column i use to fill a select tag (all the code is in a php file inside a iFrame tag): Code:

Writing To Heredoc From Text Area Form
I can't seem to get heredoc to populate correctly with variables through
a form.

<textarea name="Template" rows="10" cols="80">Template Here</textarea>

Contents could be something like: I want to replace $myarray[0] and
another variable $myarray[1]

I call heredoc this way:

$hubarray = explode("
", $contents);
$template = $_POST['Template'];

foreach ($hubarray as $val) {
$hostarray = explode(",", $val);

$output = <<<EOT
$template
EOT;

I'm feeding it a file that has multiple rows separated by
as array 1
and within those rows are fields separated by "," for array 2. I'm
trying to iterate through the arrays and populate heredoc($template)
accordingly.

How To Make Text Area Recognize Hyperlinks?
I built a simple form where a user can enter and post news items to his
site (with PHP, into MySQL). He doesn't know much HTML.

Is there some way he can enter some simple text to declare something a
hyperlink, and have PHP recognize that that means "make this text into a
hyperlink"?

....so that instead of having to type this into the textarea:

<a href="http://www.somesite.com">somesite</a>

....he could type something more intuitive, like this:

<somesite.com>somesite</somesite.com>?

Explode Text Area Into Array For MySQL Table
On my site, I have a textarea where users enter their sites' information in the following format (tab-delimited):

Site Name <tab> Site Description <tab> URL <newline>
Site Name <tab> Site Description <tab> URL <newline>
(and so on...)

I know I have to use the "Explode function and a loop to get the data into an array and enter it into a MySQL table. Would anyone have a snippet of code off-hand that could show me how to do this?

Formatting The Contents Of A Text Area Form Field
On my site I get users to enter a load of information in a textarea
box, however when i save this data to my mysql DB and then retrieve it,
it comes out without all the formatting, like new paragraphs and new
lines.

Can anyone tell me how you can capture the data entered into such a
field with all the formatting the user has entered like new paragraphs
etc?

Identify Url Written In Text Area And Display It Hyperlinked.
I am using html textarea control. user writes text in text area and i save it in database using php, then i display it where ever it is required. I want if user writes some url in the area like www.abc.com or http://www.abc.com , When i display this text as output this url must be shown there as hyperlink. by clicking over it user must be redirected to www.abc .com

Is there any html textarea control property that can do it, or i need to write some php or javascript code for it. If someone has php script for it please help. It is urgent.

Paste HTML Page Inside Text Area
i want to create a newsletter or emailer form sender. and that form has a text area. can be an ordinary text area or can also be tinymce.

i want to have the text area in such a way that an HTML page can be pasted in the text area (let say the html page is jobpost.html) and send it to the email address that i specified.

Download File And Delete File From Server With One Button Click
I want the user to be able to download a CSV file and delete the file from the server all with the click of a button.  Currently, in firefox, it will just display the CSV and not delete it. In IE, it will download the CSV and not delete it. Code:

Adding Text To Text Window With A Button
I have made an admin section of a site, What i want to do i have buttons under that have "BOLD" "center" and when clicked it adds <b></b> tags to the text area etc etc..

if the text area was called "message"

how would i going about coding the images / buttons to add the code?

Protected Area/admin Area
I am building a web site and have included an admin area where I want to use a username and password that only myself and the admin will be able to use. I am using the following code, but something is wrong when I put it on my host: Code:

Write A Button To A Text File
I am trying to do is keep a record of all the buttons that are pressed in my website (in a text file) so that I can see the parts of the site that are used. The buttons are links between pages, so I want to see what is clicked from where etc. Code:

Add A Text Box Form To Buy Button Code:
cuttently we have this code which generates a buy button on a page. where the "product_ref" call the data.

Is there an easy way to add a text box with one of these codes so a number can be entered in to post to the cart as well so the item can be personalised? Code:

Disable Submit Button If Text Field Is Empty
I am unsure if this must be done with Ajax, or if it can be done with PHP. I have a simple search page where I want the submit button to be disabled if there is nothing entered in the text field, and once something IS entered, then the search button is enabled.

I was thinking Ajax, because I am looking for it to be real time and I am not sure if its possible with PHP as I am just a novice when it comes to certain things. So the button is always disabled when there is nothing, and enabled when the user enters something.

And lets say the user enters something and removes it, then the button disables again? Is this possible to do with PHP and if so, could someone please help me tackle this . Code:

PHP Adds Hidden Value
Hallo, just today, trying to validate the code of a site of mine written
in php, I discovered that is segnalled the presence of this line:

<input type="hidden" name="PHPSESSID"
value="c108f42e24e7111ec399772308b24cb3" />

line that in the source code doesn't exist, I have checked and checked
again. Is it possibile some strange thing? Could I avoid it? For when I
try to validate the page, such page is indicated as containing an error

But stranger again, the same script if executed on a Linux Server doesn't
show this strange behaviour.

Resin Adds PHP
Interesting development?

Loop That For Example Adds 1 (like 4 + 1) To A Colums
I want to set up a loop that for example adds 1 (like 4 + 1) to a colums in a row, and then adds 1 to the same column, at the next row, when the it comes to the last row, its starts over again..

Htmlentities Adds Slashes - Why?
I'm using Apache/1.3.28 (SuSE 7.1, kernal 2.4) with PHP/4.3.2. I have the
following code to help cleanse form data.

function cleanData($sourceData, &$cleanData)
{ foreach($myData as $fieldName=>$fieldValue)
{ if(strlen($fieldValue)>0)
{ $cleanData[$fieldName]=htmlentities(trim($fieldValue)); }
else
{ $cleanData[$fieldName]=""; }
}

return;
}

cleanData($_POST, $formData);

I tested the code and found a was placed before double quotes
automatically - I have had to use stripslashes to clean the offending
slashes but I was wondering why they appeared the first place. A view
source of my html code, via my client browser produced the following (until
I used stripslashes which removed the slashes).

&quot;here&quot;

What is the recommended action here? Is it something I need switch off in
php.ini or is it safer for me just to continue and use stripslashes as part
of my function?

Nl2br( ) Function Adds Extra Br
I recently installed phpDev4 (apache, php and MySQL) for local staging of web sites before uploading to my "online" web account. I have a script that takes a field from a database and converts new line characters to <br /> using nl2br( ). I downloaded a csv table from online MySQL and loaded the csv into my local MySQL for testing purposes.

When I run this script from my online account, everything is fine. However when I run this script locally php generates an extra <br />with double quotes and a number at the end of the field data. online html ex. this is a paragraph whose <br /> newline characters are converted to the break xhtml tag.

local html ex. this is a paragraph whose <br /> newline characters are converted to the break xhtml tag."<br />6". Why is "<br />6" added on the end? Is there something within php.conf file that I need to change?

Ftp_put - Adds Empty Lines Between Every Line On Upload.
I have a CMS system that uses php's ftp functions to keep the file ownership to the user, not apache. So when a file is uploaded, it is uploaded to a temp directory, and i use "ftp_put" to move it to the right position, with correct ownership.

However, i installed the system on a server today, and when i upload php files using this method, it adds empty lines between every line. this does not happen to other non-binary files like javascript files. I have used this method for a long time, and i have never seen this before. Code:

Upload File Having Browse Button And Submit Button On Same Form
I am building a form where the user must upload a picture and fill in his
details.
Now I have a problem as all of this is on the same form.

How will I be able to have the Browse button to open the "file browse"
dialog
and the Submit button to submit the form data.

As I believe you can not use GET but must use POST method for form.
Is there any means that I can use GET cause I need to get form variables
from URL as well.

Passing Radio Button Values To A Submit Button (gif)
How do i pass the value of the radio button to be put of the action
that includes the value as part of the URL being submitted - "/
picked.php?pick_num=". Any help with be appreciated. Thanks

<form method="post" action="/picked.php?pick_num=".<php? $value ?
<input type="hidden" name="cmd" value="0">

<table width="100%">
<td align="center">
<INPUT TYPE='RADIO' NAME='pick_1' VALUE=&#391;'>Day;
<INPUT TYPE='RADIO' NAME='pick_2' VALUE=&#392;'>Week;
</td>
</tr>
<tr>
<td align="center"><input type="img src="/images/pick_now.gif"
BORDER="0" name="send"></td>
</tr>
</table>

BbCode
Can anyone recommend a simple way of implementing bbcode into a php-based website/database design? I'd like the user to be able to enter the data using bbcode's options (simple click and format options without having to know anything about code... like this site has) and have this display in pages when the results are pulled out of the database and displayed in HTML format.

BBCode
how to make BBC which will disable any code parsing (BBCode, HTML - to display both without parsing it) and tell me, which font to use with it?

Bbcode Help
This is my first time doing bbcode so I'm not really sure how to do this.  I copied this from a tutorial but it doesn't work.

$string = "I am so [b]cool[/b] ";
$bb-replace = array('[b]','[/b]','[i]',[/i]');
$bb-replacements = array ('<b>','</b>','</i>','</i>');
$string = str_replace($bb-replace,$bb-replacements,$string);

The error is a syntax error unexpected T_ARRAY.

BBcode
I making a forum and want to add BBcode to it. How can i do this? I have looked everywhere?


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