How To Change Form Field Contents In Existing PDF Using PHP?
Simple case:
1. I have a PDF file I made with Acrobat PRO. It contains a form with
two fields, "Name" and "TestScore".
2. From my PHP file on linux server I just want to open this PDF file
and change the content of the Name and Testscore form fields.
Could someone show me a simple code example on this?
And what do I need of addons? PDFlib and licences?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
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?
Change Date String To Adapt To Existing
I need to change the date format from a table that got it's date from a different souce. This format looks like this: 6/1/2007 15:26:00 It needs to look like this 2007-06-01 15:26:00. What PHP function would i use for this and how would it be done? This is the last step to a month long project I have been working on and it needs to be completed very soon.
Change The Web Page Contents On Click
I want to sort the data displayed on web page on click of button. I have a combo in which all user have to select the sort order in which he wants to see the data...(The combo box or drop down box contains values "Name, Department Salary and Grade") The user select the order (say name) by clicking the combo box or drop down box. The moment the user releases the combo or drop down box, I want to refresh the page with new sort order.
Searching The Contents Of Just One Field?
I'm trying to put together a script that will search the contents of just one field, specified by its row ID. I'm using: SELECT mailing_list, MATCH(mailing_list) AGAINST ('$emailaddress,' IN BOOLEAN MODE) AS score FROM table WHERE MATCH(mailing_list) AGAINST ('$emailaddress,' IN BOOLEAN MODE) AND row_id='$row_id' So from the code above, I wanna search the field 'mailing_list' where the row_id is of a certain value. But the result is returning information from other rows - it seems to be ignoring the AND row_id=$row_id bit.. Is there a way to use the search string above to have it search just the ONE field, in the ONE row?
Don't Show The Contents Of An Empty Field
I have a database which when queried brings back results one of which is an image name. The image name points to a subdirectory to display the image. Everything works fine but if there is no image name then the image is not found (obviously). How can I tell a result to not show the entry if it's empty? The code goes something like this mysql_select_db($databaseName,$db); $result = mysql_query("SELECT * FROM reports WHERE target_page LIKE 'News' ORDER BY description",$db); if ($myrow = mysql_fetch_array($result)) { echo " <table border=0 width=70%>n"; do { echo " <tr> n"; printf(" <td><B>%s</B></td> </tr>n", $myrow["description"]); echo " <tr> n"; printf(" <td>%s</td> </tr>n", $myrow["paragraph_1"]); echo " <tr> n"; printf(" <td>%s</td> </tr>n", $myrow["paragraph_2"]); echo " <tr> n"; printf(" <td><IMG SRC=%s></td> </tr>n", $myrow["image"]); echo " n"; printf(" </tr>n", $myrow[""]); } while ($myrow = mysql_fetch_array($result)); echo " </table>n"; } else { echo "Sorry, no records were found!"; } ?> Any help would be appreciated
Why Doesn't Echo Match Field Contents?
Why is it that emails.from name or $from_name echoes as 'Joe Blow' in the following script WHEN the entire from_name field contents actually == 'Joe Blow <jblow@att.net>' AND how might I use that field to find and update a contacts table record where contacts.full LIKE $from_name? Tried numerous variations on the following but no luck. PHP Code:
Checking Form Contents
I would like to verify the contents of a form before inserting the data into a mySQL database. How can I check the contents of the form and return the user to the form if they have not completed all the required fields(with the data they have entered intact). Only after the form is verified to contain all the mandatory data do I want to insert it into the database. In addition, it would be great if I could highlight the fields that are missing data. Currently, I have a php script handling the submission and insertion. Is it possible to make that submission conditional?
Add Form Field Values Into Php Seesion Variable Before Submitting The Form
I have php page which is basically a simple html form containing some text fields.The user will type in values in it and submit it .Now what i want is that just at the time of submittion i want to assign the form field values in session variables. I nwwd this b'coz the form is being submitted into a cgi script which has been given to me.Now the cgi script is an executable one and i am unable to view or change its content,Its functionability is to change a password for a linux user account .Now the cgi script after completing the job is redirected to another html page.What i have to do is that i need to trap the user input and update the values in a mysql database .Now if i can assign the values in a session variable then i can do the updatation from some later pages.
Session Variables Resets The Contents Of A Form
i have a form in a page that has a header with a session variable the problem is that if i fill the form and submit the form to another page, now if i want to go back to the form using the back button of the browser the contents of the form will be reset!!! please tell me what to do if this is a common problem or i can get rid of this problem cause it's annoying to fill the form again. PHP Code:
Security Issues With Posting Form Contents To Server?
I'm currently reading a php book that attempts to declare the security hazzards of not screening a form's content before allowing it to be posted, whether to a database, text file, or otherwise. Honestly, I still don't get what the problem is. Lets say magic quotes is turned on. Could someone list the major things I should still be doing to prevent security problems? For example, the book says to use htmlspecialchars(), though how does allowing the user to enter HTML tags compromise anything? The data simply gets posted as is to a database, then output as is Maybe an annoying JavaScript is output, but hardly a security breach to the server itself as far as I can tell.
Retrieving Contents Of Select List On Form Submit
On an HTML form, I have a select list that is fed dynamically with detail records when the master record is displayed on the form. There is also a second lookup list, and want to allow the user to dynamically select from this list and add to the first list. I also want the user to be able to dynamically remove from and reorder the first list. I think I can do all of this with JavaScript. The question I have, is how can I retrieve the contents of the first list when the user submits the form? I need to get it back into a php array so I can update and add the proper database records.
Can A Form Change Session Variables?
In the first page I declare a session variable. Than, on the same page, I make a form which contains a variable which has the same name as the mentioned session variable. Pressing the "submit" button of the form I go to the second page which immediately redirects me back to the first page (with the "header"). And the mentioned variable does...
How Do I Create A PHP And MySQL Change Password Form With MD5?
Summary: I a beginner with PHP and I am creating a secure customer portal using php and MYSQL I am using logon scripts and storing passwords with MD5 encryption. I am able to: get the password to be stored into the database as MD5 and the user can log in sucessfully. My problem: Comes when I am trying to make a password reset form where I (the admin) can change the users password to a temporary password (cant figure out how to do this), then the user can logon with the temporary password and change the temporary password to a new one.(cant figure out how to do this either). The variable does hold the hash, but its not being updated in MySQL. The Code: I am trying to use the following command with no luck: $query = "UPDATE user SET `password`='$newpassword' WHERE id='$id'"; $result = mysql_query($query); Am I doing somthing wrong? I have tried many differnt version and ways to do this with none being sucessful.
Form Field To Array
Ok, two questions: 1) I have a mulitple select form field. It is named 'artists[]' and it produces the array artists[$i] correct? now i want to make the array into a single variable named $artists that containes the array in a CSV format with no ending comma. how do i do that? 2) Is it possible to browse for a directory and pass it though a script as text? not a file, just a directory?
PHP Form Field Update...
I am sure this has been answered here somewhere, but I have searched for a good 2-3 hours and can't seem to locate a solution. Additionally, I really don't want anyone to solve this mystery for me (at least not all the way!) - But I was hoping someone could point me in the right direction here. I am trying to figure out how to update form field information before the end user hits the submit button - for example, if they select that they are from California from the "state" drop down list, only counties from California would show up in the "county" drop down list. BTW, this is only a hypothetical example - I am only using this code to build a photo manager for my website! Anyone able to: 1) tell me what this process is called - it's hard to search for answers when you don't know what you're looking for. 2) point me in the right direction of a solution.
Form Field Testing
I have this site which people submit sites to it. What I need is for when they submit their info to the form, they enter their url into the form field and then next to that there is a test button, when they click this button in a new window it will load their site. I know there is a way to do this with java and php but not sure how to do it. Also is there a way to have it so their site is scanned and if it contains popups they will be denied access to join?
Form Field Value Containing Backslash
I have recently taken up PHP programming, and I got stuck on the following. <? $p_body = (isset ($_POST['body' ]) && ($_POST['body'] != '')) ? $_POST['body'] : 'Enter your text here' $p_name = (isset ($_POST['name' ]) && ($_POST['name'] != '')) ? $_POST['name'] : 'Enter name' $p_mail = (isset ($_POST['mail' ]) && ($_POST['mail'] != '')) ? $_POST['mail'] : 'Enter email' $output = <<<CODEREH <form method="POST" action="doform.php"> <p><input type="TEXT" name="name" value="$p_name" /></p> <p><input type="TEXT" name="email" value="$p_mail" /></p> <p><input type="TEXT" name="body" value="$p_body" /></p> <p><input type="SUBMIT" value="Store it!" /></p> </form> CODEREH; $invalid_body=array('','Enter your text here'); $invalid_name=array('','Enter name'); $invalid_mail=array('','Enter email'); if (validate($p_body,$invalid_body) && validate($p_name,$invalid_name) && validate($p_mail,$invalid_mail)) // fields not entered correctly { //process form data and provide link to continue (or enter another set of data) exit; } // data not entered correctly echo "All fields must be entered!"; ?> If either field contains backslashes, they are duplicated when the form reloads. Each successive form submission becomes , \, \\ etc etc Why does this happen and how do I fix the variables to show the original data each time? I know I am a newbie, probably an easy one for this group.
Form Field Set Focus?
I'm still something of a newbie to html/php/mysql. I have a php/html form with several fields of type "input". If the user enters improper data in a particular field and clicks the Submit button, the php script has to trap it and return a javascript error message box with an OK button. That part I've already got down. But, you know how in Visual Basic you can set the focus on the offending field on a form, so if the user gets a Message Box with an error message and clicks OK, the form goes something like, myForm!myField.SetFocus Is there an equivalent way in php/html way do this?
Splitting A Form Field
I am coding a form which stores info in a mysql DB. The form is ment to post and edit info on antiquarian books. My title field (<TEXTAREA>, so i can't give a maximum of characters) cannot contain more than 255 characters, but some books might have a longer title. I want to cut off all chars that exceed 255 (words should remain intact) and paste them into the description field. How can I accomplish this? I can count the chars with strlen , but how do I chop off the chars which exceed the maximum, keeping the words intact and paste them in another field?
Variable In Form Field
I want to put a variable as the content of a hidden field. I realise that normally you would just open up a set of php tags and echo the variable in which I have done in the past, although I need the whole form in php tags as I have made the form a function in order to hide it with sessions when no body is logged in. This seems to be causing a problem as I can't get the content of the variable into the field its just echoing the actual statement in. Code:
Form Field Validation
When validating user input I check it's not empty and then run 'mysql_real_escape_string($s)', I was then going to make sure that it is only alphanumeric, but I wanted to allow certain other characters as well. Realising this must be done before the mysql escape check, what characters should be blocked because they are dangerous, I can only really think of quotes and $. The real escape check should handle the quotes issue, so is the $ an issue or not?
Form Field Content And Sessions
I've searched for this and found similar problems, though not quite what I'm after. Basically, I'm using sessions for logins, keeping user data readily available etc. but when a user submits a form and then uses the back button to return to the form (if an error is given through some fields not being filled for example), the form fields are emptied unlike normally when it keeps the data you submitted. Is the solution to this simply the session_cache_limter() trick or is their a better, more backwards-compatible solution? I ask as I'm running PHP 4.0.1 at the moment so haven't been able to try it yet. Any help/suggestions are much appreciated.
Form Field Dynamic Population And PHP
I have a form that dynamically generates a drop down from a table column called suppliers. Products supplied by each supplier vary so what I want to try and achieve is that once a supplier has been selected a second drop down on the same page is populated with data from the same table / different column with that suppliers products. (I am trying to avoid refreshing the page) I have not supplied any code at this stage as I am not sure whether PHP is capable of doing this by itself or whether javascript would need to be incorporated.
Autmatic Form Field Fill
I have two fields in a form. The first is the email field the second is the username. Now I want the username field to be filled automatically with the part before "@" of the first field. So if someone fills in "brain@domain.com" the second field has to be filled with "brain".
Form Text Field Validation
I've got a form and I'm now trying to validate the text fields in it. The field I want to validate is for someones name, so there should only contain letters. Below is the function I've written to handle this. Code:
How To Hide 'hidden' Form Field?
I am sending the user's password in form's hidden field as Code: <input type=hidden name="studen_pass" value="readfromdatabase"> but i dont want anyone to read it via watching its source code. is there any trick to hide it with php so that no one can read the password hidden field value by watching page's source code.
Increment A Text Field In A Form
I am creating an intranet which shows active projects and allows people to add new projects. If users want to add a new project, they fill in a form but what I want the form to display in the ProjectNumber field (which is a var char field & not the primarykey) is the last Job Number incremented by 1. For example if the last ProjectNumber was TS0014, then the default value in the ProjectNumber field should be TS0015 - this way users know what the next job number is. At present, the last job number in my table is TS0014. Below is the code i'm using but for some reason in the Job Number field in the form Im getting TS001? WHY? Code:
Form Field Text Output
How can I get html code in an editable form field to display properly? Specifically: I have text that is echoed to a form field via <? echo $text ?> The user can then edit that text and submit. However <BR> is showing up as a literal <BR> and should be a linefeed. Is there a way to have this display properly? Example: LINE ONE<BR>LINE TWO should display as LINE ONE LINE TWO Note that this is only a problem in the form field. It displays properly when echoed outside of the form.
How To Get Un-escaped Text From A Form Field
I have a php script that gets the text from a form field: <?php include("global.inc.php"); pt_register( 'POST', 'test1'); echo $test1; ?> The text comes back fine, just some characters (', " and ) are now escaped (', " and ). The problem is that I need the he text to be exactly as it was entered by the user. I could process the text myself, and replace the escaped characters, but I'd like first to understand why this is happening and if there is a way to disable this behavior and get the unmodified text directly.
Php - Mysql Form Field Generator
does anyone know of a simple function/class that will take config options: table name and the database connection stuff(or whatever) It will then print out appropriate form fields to allow editing of a row? The reason being is that in the admin section of a website I am building we are constantly adding columns to a table...It is used for keeping config options of the site. We do not wanna update the form each time we add a column.
Web Mail Form Problem With One Field...
The code below is in my contactform.php file which takes variables from a contact form built in flash on my website. Three of my fields work correctly, but the phone field does not. It is always displayed as blank in the resulting email. I've tested the variable being sent from the swf on flash and the telephone variable is populated. Can anyone see the error in this code regarding $phone? Code:
HTML Form Field Value And Php Array
I am creating a html form which has 5 html list menu and menu value get store in array after hitting submit button. The value stores in PHP array and then print on same page and then after re checking the value If i want modification then click the edit button and value re store in the same html form. Here we are not using the database. If it is possible then please provide me the code and if there is any other solution to this problem them please guide me. for above problem please avoid the java script in php code.
Form Field *required* Validation
I have php form I'm trying to edit. Some of the fields on this form is required, and some aren't. I want to adjust it so none of the field is required. But I am not able to find the place to set this value. Following are 2 piece of the code for 2 fields, 1 is required and 2nd is optional. Please help me determin where I might be able to adjust the validation. Code:
Strpos To Validate A Form Field
I am trying to validate a form field. I have provided an example below. Basically I want to check that 'a' ($findme) is the 1st and 2nd character in the string (0 and 1 position). <?php $mystring = 'aakjhabc' $findme = 'a' $pos = strpos($mystring, $findme); // Note our use of ===. Simply == would not work as expected // because the position of 'a' was the 0th (first) character. if ($pos === 0) { echo "The string '$findme' is the $pos digit"; } else { echo "The string '$findme' was found in the string '$mystring'"; echo " and exists at position $pos"; } ?> I am wondering, can strpos be used to find the specific character more than once in the string? As you see above, the 'aa' is the first 2 characters in the string. $pos equals 0 because it finds the first 'a' in the string, and I guess it doesn't look for the 2nd 'a'? If strpos can't be used for what I want, what other method can I use? I'd like to keep it in an IF statement and relatively simple. Any help much appreciated. Thanks for reading.
Automatic Select Form Field Default
I would like to allow registered users to my site the ability to change your personal information. Let's say the country in which they are in. The country field is a drop down list. So its supposed to read from the table and make the value the default. How am I going to do this?
Reading MySQL Data In A Form Field
i am in the process of building an admin page for a site. Most of my site data is being held in MySQL and being pulled using PHP. The problem I have is while trying to build an Admin form to change data in MySQL, I want to have the data that is currently in the table be automatically put into the form field, so they can see what they are changing before they change it, or so if they do nothing it keeps the same data in it. My code is as follows:
How To Process Dynamic Form Field Names
Let me start by saying I don't have a lot of PHP experience, and am just starting to fumble my way around some of this stuff... I'm sure this has been asked a number of times, but after 2 days of searching the internet, I just haven't found a solution that makes sense, so I am hoping someone here can help me. I have a pretty simple project schedule sort of web page that lists a number of tasks & 4 dates associated with each task. (planned start, planned complete, actual start, actual complete. The page is built dynamically based on what is in a mysql database, and the dates listed are form fields, with the intent that a person with access can change any number of these dates. Each task has an id associated with it, so when i build the form, I name the form field <task_id>-<date type>. so, for example, for task id = 10 I have 4 related form fields: 10-planned_start 10-planned_complete 10-actual_start 10-actual_complete This basic pattern is repeated for all the tasks (up to 100 right now, but it could grow slightly). Once all the form fields have been updated, and the user clicks submit I want to update the data in the database with the appropriate data. So, my questions is: 1) How can I process this form, when I don't know what the names of the fields are going to be, and/or how many fields there are? 2) Is there a good way to identify only those fields that have changed and do updates on only those fields, or am I "stuck" updating all the records, even those where the dates have not changed from when the form was built?
Changing Stuff In A Form Field To A Variable
I want to be able to change stuff typed into some form fields into a value so I can upload to a mysql table, then have it displayed on another page. I'm just not sure how to transport the form text.
Extract Form Field Names When They're Not Known In Advance
I have a page with a form which has automatically generated fields, (which come from mysql column names). There could be any number of these fields, and I have no way of knowing exactly what they're called. But obviously I need to know their names, in order to extract their values on the submission page. They are either of the form c%status#, e%status# or t%status# % is a number between 1 and 13 (inclusive) # could be anything in the pattern 01, 02, 03, with no limit Eg: fields could be c2status03 and e4status07, but I don't know this in advance. These would be generated on the fly from mysql. But on the submission page I need to be able to generate the code $var1=$_POST['c2status'] and $var2=$_POST['e4status07'] Is there a way for me to somehow get these names so I can extract their values on the submission page? Or have I hit a dead end?
Mandatory Email Field? - Contact Form
I'd like to make a contact page for a website where the email field is mandatory. I've used Smarty to make the page, and at the moment it works fine and displays fine. The few code edits I've manually made don't appear to work. I'd like to redirect the user to an error page if they forget to include their return email address. Code:
Storing Longtext In Mysql Using Form Field
I have a form which has the following part defined: <tr> <td> Description</td> <td><textarea name="mydescription" cols="50" rows="5"> <?php echo $fields[mydescription]?></textarea></td> </tr> Now, when I enter in some sentences into the textarea, and do a submit, I then extract the value and insert into the mysql db. The field in the DB is defined as a longtext. The problem is that this seems to only work if my sentence has about 15 words (approx 2 rows). If I go beyond 15 words, it won't store it. I don't seem to be getting any errors output either. I was thinking that perhaps the form itself is causing the issue since when entering in the data, it does a wrap around. Note if I do 15 words or less, it is stored properly in the DB.
Prevent A Single Space In A Form Field
I am allowing the user to create a URL and I would like to prevent the form from processing if they type something like 'jake 12' How would I check for a space?
Single Quotes In Database Field Breaks Form?
<?php echo "<input type=text name='storename' value='$storename'>"; ?> I noticed that if $storename contains something like "Ma's Bakery", all that shows up in the field is "Ma". Do I really have to go through all my form fields and change them to <?php echo "<input type=text name='storename' value='".$storename."'>"; ?> Although I guess <?php echo "<input type=text name='storename' value="$storename">"; ?> would work, too.
Repeat Form Field Based On $_POST Data
i have a script that sets up a second page with multiple select boxes. the first script has a hidden field for the ID number, and a text input field for quantity. the second part of the script has a foreach loop that gets the info that goes with the ID number and then creates the select box next to it. for the most part it's all working correctly, but i don't know how to get the submitted "quantity" to repeat that ID number (and everything else). here is the initial form: Code:
Show Stored Value For Form Field Type=file
I have a file-uploading form to uploads a .jpg file and stores its name in a table in my db as co_bannerfile. I'm trying to now write an update form so the user can update their .jpg file. I've successfully written a query to retrieve the stored file's name. How can I display the stored file's name so the user can see its name within the input TYPE="file" field and then decide to update it or not? The following doesn't display the stored file name. What do I have wrong? Code:
|