PHP - Sticky Form: Text Area Field Not Retaining Content
Hello all.
I'm new here... and new to php... so please be gentle if I'm overlooking something that's blindingly obvious. I have a 'view blog entries' page and an 'edit blog entries' page. When I go to the 'edit blog entries' page, I want the form fields to display the preexisting blog content for whatever entry I'm about to edit. The code below does display the 'title' but it does not display the 'article' content. (However, the 'title' and 'article' content both show when I view the source code.) Can anyone tell me what I could be doing wrong? Thanks in advance. Code: [Select] // Retrieve the blog post's information: $q = "SELECT title, article FROM entries WHERE article_id=$article_id"; $r = @mysqli_query ($dbc, $q); if (mysqli_num_rows($r) == 1) { // Valid blog entry ID, show the form. // Get the blog entry's information: $row = mysqli_fetch_array ($r, MYSQLI_NUM); echo '<form action="edit_entry.php" method="post"> <p>Title:<br /> <input type="text" name="title" size="45" maxlength="80" value="' . $row[0] . '" /></p> <p>Blog entry<br /> <textarea name="article" id="article" cols="45" rows="5" ' . $row[1] . '></textarea> </p> <p><input type="submit" name="submit" value="Submit" /></p> <input type="hidden" name="submitted" value="TRUE" /> <input type="hidden" name="article_id" value="' . $article_id . '" /> </form>'; } else { // Not a valid entry ID. echo '<p class="error">This page has been accessed in error.</p>'; } mysqli_close($dbc); ?> Similar TutorialsI want a Text Area on my form where I can enter the body of an article. It should be sticky so the input is not lost if there are form issues and the form has to be re-loaded. The problem is that when I type "mmm" into this field, after I click "Submit" my form is reloaded - because I didn't complete it - and several blank lines appear before and after the text "mmm"?! Here is my code... Code: [Select] <!-- Body --> <li> <label for="body"><span class="required">*</span>Body:</label> <textarea id="body" name="body" class="text" cols="20" rows="5" wrap="soft"> <?php if(isset($body)){echo htmlentities($body, ENT_QUOTES);} ?> </textarea> <?php if (!empty($errors['body'])){ echo '<span class="error">' . $errors['body'] . '</span>'; } ?> </li> What seems to be the problem?! Debbie I cannot figure out how to retain the inputted information once submit is pressed. I want the user to enter their first name, last name, hours of work, and hourly pay rate. Then, I want them to press submit. Their pay will be calculated and displayed, but I still want their inputted information to be visible. How can I do that?? Here is my code: Code: [Select] <html> <head> <?php $pay = $_POST['pay']; $hours = $_POST['hours']; $extra = $_POST['extra']; $rate = $_POST['rate']; if ($hours > 40){ $extra=$hours-40; $hours=40; $pay=($extra*1.5*$rate)+($hours*$rate); } else { $pay=$hours*$rate; } echo "Your pay is: <br /> $ $pay <br />" ; ?> </head> <body> <form method='post' action='pay2.php'> First Name: <input type='text' name='first'><br/> Last Name: <input type='text' name='last'><br/> Hours of Work: <input type='text' name='hours'><br/> Hourly Pay Rate: <input type='text' name='rate'><br/> <input type='submit' value='submit'> </form> </body> </html> Hi, I want to be able to let user type in xml text and it will be parsed and uploaded to db, but it doesn't work, it just keeps redirecting me back to this form below! here is html form: Code: [Select] <html> <body> <form method='post' method='form.php'> <p> <textarea name="pastedXML" rows="10" cols="30"> Please paste your xml file here. </textarea> </p> <p> <input type="submit" value="Convert to SQL" name="textXML" /> </p> </form> </body> </html> Here is script (form.php;I just want to retrieve the contents typed in text area to store to variable...how??) Code: [Select] <?php //get the text in textarea and shred it! if(isset($_POST['textXML'])) print $_POST['pastedXML']; ?> Any help much appreciated! Assist a newbie! Hey guys, I am a webmaster for my church and I am fairly new to PHP. What am trying to is when a visitor goes to our radio ministry page and clicks a button which the message number is displayed in the read only textbox, it will go to my request CD page and auto populate the message number in that text field form the readonly text field from the previous page. I will show my code for both pages for you to review. This is the Radio page (where I want to take the message number value from) Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="Living Word Community Church radio ministry" /> <meta name="keywords" content="reformed radio fort worth, reformed radio dallas, biblical radio fort worth, biblical radio dfw" /> <title>In Light of Scripture-Radio Ministry</title> <link href="_css/Main.css" rel="stylesheet" type="text/css" /> <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script> <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="container"> <div class="header"><a href="index.php"><img src="_images/LWCCWeb.jpg" alt="Insert Logo Here" name="Insert_logo" width="960" height="200" id="Insert_logo" style="background: #D8BF78; display:block;" /></a> <?php include("_includes/header.php"); ?> <div class="sidebar1"> <p></p> <table width="150" border="0" cellpadding="10" align="left"> <tr> <td><a href="directions.php"><img src="_images/ChurchBox.png" width="150" height="125" alt="Directions" /></a></td> </tr> <tr> <td><img src="_images/Service Times.png" width="150" height="778" alt="Service Times" /></td> </tr> </table> <!-- end .sidebar1 --></div> <div class="content"> <div id="radio"></div> <table width="600" border="0" cellpadding="10"> <tr> <td><img src="_images/ILOS.png" width="600" height="111" alt="In Light of Scripture" /></td> </tr> <tr> <td style=" padding-top:25px"><p><font size="5"><b>In Light of Scripture</b> has been locally broadcast for more than 25 years.<br /> This Sunday morning radio program features the expositional teaching of Pastor Stan McGehee Jr. </font><p/></td> </tr> </table> <div id="mediagraph"><a href="http://kdkr.org" target="_blank"><img src="_images/kdkr.jpg" width="300" height="200" alt="Braodcast on KDKR 91.3 Sunday Mornings at 7:30" /></a></div> <br /><br /> <font size="2"><p align="center"><b>The sermon featured this week on "In Light of Scipture" is</b></p></font> <font size="2"><p align="center" style="color:#711726"><b><i>Peace Despite Tribulation</i></b></p></font> <div id="messagenumber" align="center"> <form action="" method="get" name="messagenumber"> <input name="" type="text" value="JR-843" size="6" readonly="readonly" /> <input name="GetMessage" type="button" value="Get Message" /> </form> </div> <!-- end .content --></div></div> <div class="sidebar2"> <table width="150" border="0" cellpadding="16" align="left"> <tr> <td><a href="reformation.php"><img src="_images/MenuBox1.png" width="150" height="125" alt="What Do We Mean by Reformed?" /></a></td> </tr> <tr> <td><a href="ServiceTimesAndCal.php"><img src="_images/MenuBox2.png" width="150" height="125" alt="Worship Service Schedule and Calendar" /></a></td> </tr> <tr> <td><a href="radio.php"><img src="_images/MenuBox3.png" width="150" height="125" alt="In Light of Scripture Radio Ministry" /></a></td> </tr> <tr> <td><a href="cable.php"><img src="_images/MenuBox4.png" width="150" height="125" alt="Living Word Today Cable Program" /></a></td> </tr> <tr> <td><a href="Sermons.php"><img src="_images/MenuBox5.png" width="150" height="125" alt="Listen to Sermons Online" /></a></td> </tr> <tr> <td><a href="http://www.lwcchurch.org/blog/" target="_blank"><img src="_images/MenuBox6.png" width= "150" height="125" alt="Read our reformed blog" /></a></td> </tr> </table> <!-- end .sidebar2 --></div> <?php include("_includes/footer.php"); ?> <!-- end .container --></div> <script type="text/javascript"> var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"}); var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"}); </script> </body> </html> This is for the CD request form. I want it to populate the Message# text field Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="Order Living Word Community Church sermons and teachings on CD" /> <meta name="keywords" content="Stan McGehee cd, Reformed teachings on cd, Biblical teachings on cd, LWCC cds" /> <title>Order CD's Online</title> <link href="_css/Main.css" rel="stylesheet" type="text/css" /> <link href="js/jquery.datepick.css" rel="stylesheet" type="text/css" /> <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script> <script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script> <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="jquery/jquery-1.5.js"></script> <script type="text/javascript" src="js/jquery.datepick.js"></script> <script src="SpryAssets/SpryValidationSelect.js" type="text/javascript"></script> <script src="SpryAssets/SpryValidationRadio.js" type="text/javascript"></script> <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> $(function() { $('#popupDatepicker').datepick(); $('#inlineDatepicker').datepick({onSelect: showDate}); }); function showDate(date) { } </script> <link href="SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css" /> <link href="SpryAssets/SpryValidationRadio.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="container"> <div class="header"><a href="index.php"><img src="_images/LWCCWeb2.png" alt="Insert Logo Here" name="Insert_logo" width="960" height="200" id="Insert_logo" style="background: #D8BF78; display:block;" /></a> <?php include("_includes/header.php"); ?> <div class="sidebar1"> <p></p> <table width="150" border="0" cellpadding="10" align="left"> <tr> <td><a href="directions.php"><img src="_images/ChurchBox.png" width="150" height="125" alt="Directions" /></a></td> </tr> <tr> <td><img src="_images/Service Times.png" width="150" height="890" alt="Service Times" /></td> </tr> </table> <!-- end .sidebar1 --></div> <div class="content"> <h2 style="padding-left:50px"> Order messages on CD from LWCC</h2> <div id"form"> <form action="FormToEmail2.php" method="post"> <table width="550" border="0" cellpadding="10"> <tr> <td><table width="550" border="0" cellpadding="10"> <tr> <td width="190">First Name:</td> <td width="314"><span id="spryfirstname"> <input name="firstname" type="text" id="firstname" maxlength="20" /> <span class="textfieldMaxCharsMsg">Too many letters</span><span class="textfieldRequiredMsg">Enter first name </span></span></td> </tr> <tr> <td>Last Name:</td> <td><span id="sprylastname"> <input name="lastname" type="text" id="lastname" maxlength="20" /> <span class="textfieldRequiredMsg">Enter last name</span><span class="textfieldMaxCharsMsg">Too many letters</span></span></td> </tr> <tr> <td>Email<font size="2"> (So we can confirm if needed)</font>:</td> <td><span id="spryemail"> <input name="email" type="text" id="email" maxlength="50" /> <span class="textfieldRequiredMsg">Enter Email</span><span class="textfieldInvalidFormatMsg">Must be Email.</span><span class="textfieldMaxCharsMsg">Email too long</span></span></td> </tr> <tr> <td>Street:</td> <td><span id="sprystreet"><span id="sprystreet"> <input name="street" type="text" id="street" maxlength="50" /> <span class="textfieldRequiredMsg">Enter Street Address</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span></td> </tr> <tr> <td>City:</td> <td><span id="sprycity"><span id="sprytextfield5"> <input name="City" type="text" id="city" maxlength="50" /> <span class="textfieldRequiredMsg">Enter your city</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span><span class="textfieldRequiredMsg">Enter Email</span><span class="textfieldInvalidFormatMsg">Must be Email.</span><span class="textfieldMaxCharsMsg">Email too lon</span></span></td> </tr> <tr> <td>Apartment number:</td> <td><span id="aptnum"> <input name="Apt number" type="text" id="aptnum" maxlength="6" width="80px" /> <span class="textfieldRequiredMsg">Enter Email</span><span class="textfieldInvalidFormatMsg">Must be Email.</span><span class="textfieldMaxCharsMsg">Email too long</span></span></td> </tr> <tr> <td>State:</td> <td><span id="spryselect1"> <select name="statelist"> <option value="null"></option> <option value="Alabama">AL</option> <option value="Alaska">AK</option> <option value="Arkansas">AR</option> <option value="Arizona">AZ</option> <option value="California">CA</option> <option value="Colorado">CO</option> <option value="Connecticut">CT</option> <option value="Deleware">DE</option> <option value="District of Columbia">DC</option> <option value="Florida">FL</option> <option value="Georgia">GA</option> <option value="Hawaii">HI</option> <option value="Idaho">ID</option> <option value="Iowa">IA</option> <option value="Illinois">IL</option> <option value="Indiana">IN</option> <option value="Kansas">KS</option> <option value="Kentucky">KY</option> <option value="Louisiana">LA</option> <option value="Massachusetts">MA</option> <option value="Maryland">MD</option> <option value="Maine">ME</option> <option value="Michigan">MI</option> <option value="Minnesota">MN</option> <option value="Missouri">MO</option> <option value="Mississippi">MS</option> <option value="Montana">MT</option> <option value="Nebraska">NE</option> <option value="New Hampshire">NH</option> <option value="New Jersey">NJ</option> <option value="New Mexico">NM</option> <option value="Nevada">NV</option> <option value="New York">NY</option> <option value="North Carolina">NC</option> <option value="North Dakota">ND</option> <option value="Ohio">OH</option> <option value="Oklahoma">OK</option> <option value="Oregon">OR</option> <option value="Pennslyvania">PA</option> <option value="Rhode Island">RI</option> <option value="South Carolina">SC</option> <option value="Tennessee">TN</option> <option value="Texas">TX</option> <option value="Utah">UT</option> <option value="Vermont">VT</option> <option value="Virginia">VA</option> <option value="Washington">WA</option> <option value="Wisconsin">WI</option> <option value="West Virginia">WV</option> <option value="Wyoming">WY</option> </select> <span class="selectRequiredMsg">Please select state</span></span></td> </tr> <tr> <td>Zip Code:</td> <td><span id="spryzip"><span id="sprytextfield6"> <input name="Zip Code" type="text" id="zip" maxlength="50" /> <span class="textfieldRequiredMsg">Enter Zip Code</span><span class="textfieldInvalidFormatMsg">Zip Code is 5 numbers.</span></span><span class="textfieldRequiredMsg">Enter Email</span><span class="textfieldInvalidFormatMsg">Must be Email.</span><span class="textfieldMaxCharsMsg">Email too lo</span></span></td> </tr> <tr> <td>Which Pastor or Teacher?</td> <td> <div id="spryradio1"> <table width="250"> <tr> <td><label> <input type="radio" name="Speaker" value="Pastor Stan McGehee" id="radiogroup_4" /> Pastor Stan McGehee Sr</label></td> </tr> <tr> <td><label> <input type="radio" name="Speaker" value="Pastor Stan McGehee Jr" id="radiogroup_5" /> Pastor Stan McGehee Jr</label></td> </tr> <tr> <td><label> <input type="radio" name="Speaker" value="Pastor Jack McFarland" id="radiogroup_6" /> Pastor Jack McFarland</label></td> </tr> <tr> <td><label> <input type="radio" name="Speaker" value="Steve Bader" id="radiogroup_7" /> Steve Bader</label></td> </tr> </table> <span class="radioRequiredMsg">Please select speaker</span></div></td> </tr> <tr> <td>Where did you hear message?</td> <td> <div id="spryradio2"> <table width="200"> <tr> <td><label> <input type="radio" name="How did you hear?" value="At LWCC" id="RadioGroup1_0" /> At our church</label></td> </tr> <tr> <td><label> <input type="radio" name="How did you hear?" value="On the Radio" id="RadioGroup1_1" /> On the Radio</label></td> </tr> <tr> <td><label> <input type="radio" name="How did you hear?" value="On Cable" id="RadioGroup1_2" /> On Cable</label></td> </tr> </table> <span class="radioRequiredMsg">Please make a selection</span></div></td> </tr> <tr> <td>What service?</td> <td><div id="spryradio3"> <table width="248"> <tr> <td width="240"><label> <input type="radio" name="When did you hear message?" value="Sunday AM" id="When did you hear message?_0" /> Sunday AM</label></td> </tr> <tr> <td><label> <input type="radio" name="When did you hear message?" value="Sunday PM" id="When did you hear message?_1" /> Sunday PM</label></td> </tr> <tr> <td><label> <input type="radio" name="When did you hear message?" value="Wednesday PM" id="When did you hear message?_2" /> Wednesday PM</label></td> </tr> <tr> <td><label> <input type="radio" name="When did you hear message?" value="Adult Sunday School" id="When did you hear message?_3" /> Adult Sunday School</label></td> </tr> </table> <span class="radioRequiredMsg">Please make a selection.</span></div></td> </tr> <tr> <td>Message Number <font size="2">(If known)</font>: </td> <td><input name="Message#" type="text" id="messagenumber" maxlength="50" /></td> </tr> </table> </td> </tr> <tr> <td><table width="550" border="0" cellpadding="10"> <h3 style="padding-left:135px">Please pick date of message</h3> <div id="selectdate" align="center"><input id="inlineDatepicker" name="When Did You Hear?" type="text" /></div> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("UA-4715900-1"); pageTracker._initData(); pageTracker._trackPageview(); </script></table></td> <tr> <td style="padding-left:250px"><input name="submit" value="Submit" type="submit" /> <input name="clearBtn" type="reset" /></td> </tr> </table> </td> </tr> </table> </form></div> <!-- end .content --></div></div> <div class="sidebar2"> <table width="150" border="0" cellpadding="25" align="left"> <tr> <td><a href="reformation.php"><img src="_images/MenuBox1.png" width="150" height="125" alt="What Do We Mean by Reformed?" /></a></td> </tr> <tr> <td><a href="ServiceTimesAndCal.php"><img src="_images/MenuBox2.png" width="150" height="125" alt="Worship Service Schedule and Calendar" /></a></td> </tr> <tr> <td><a href="radio.php"><img src="_images/MenuBox3.png" width="150" height="125" alt="In Light of Scripture Radio Ministry" /></a></td> </tr> <tr> <td><a href="cable.php"><img src="_images/MenuBox4.png" width="150" height="125" alt="Living Word Today Cable Program" /></a></td> </tr> <tr> <td><a href="Sermons.php"><img src="_images/MenuBox5.png" width="150" height="125" alt="Listen to Sermons Online" /></a></td> </tr> <tr> <td><a href="http://lwcchurch.blogspot.com" target="_blank"><img src="_images/MenuBox6.png" width="150" height="125" alt="Read our reformed blog" /></a></td> </tr> </table> <!-- end .sidebar2 --></div> <?php include("_includes/footer.php"); ?> <!-- end .container --></div> <script type="text/javascript"> var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"}); var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"}); var sprytextfield1 = new Spry.Widget.ValidationTextField("spryfirstname", "none", {validateOn:["blur"], maxChars:20}); var sprytextfield2 = new Spry.Widget.ValidationTextField("sprylastname", "none", {maxChars:20, validateOn:["blur"]}); var sprytextfield3 = new Spry.Widget.ValidationTextField("spryemail", "email", {maxChars:50, validateOn:["blur"]}); var sprytextfield4 = new Spry.Widget.ValidationTextField("sprystreet", "none", {validateOn:["blur"], maxChars:50}); var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5", "none", {maxChars:50, validateOn:["blur"]}); var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", {validateOn:["blur"]}); var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6", "zip_code", {validateOn:["blur"]}); var spryradio1 = new Spry.Widget.ValidationRadio("spryradio1"); var spryradio2 = new Spry.Widget.ValidationRadio("spryradio2"); var sprytextfield7 = new Spry.Widget.ValidationTextField("sprymessagenumber", "none", {isRequired:false}); var spryradio3 = new Spry.Widget.ValidationRadio("spryradio3"); </script> </body> </html> Stumped! I have a client who has a form where they upload files to their server: title, two password fields, and the file
They have been unable to upload anything over 10m
Small (under 10mb) files work.
Larger doesn’t
I’ve tracked it down, I think, that the processing page appears to be dropping the form values when the file takes a bit to upload.
I echo’ed the values that are grabbed from the form, and they return empty strings if it takes a while for the file to upload (a large file) - they pass fine if the file is smaller.
I think I've got the php info set correctly, but cannot for the life of me figure out how to adjust the timing out issue, or even where to troubleshoot.
Here's my phpinfo:
Max Requests
Per Child: 750 - Keep Alive: off - Max Per Connection: 100
Timeouts
Connection: 120 - Keep-Alive: 5
Directive
Local Value
Master Value
allow_call_time_pass_reference
Off
Off
allow_url_fopen
On
On
allow_url_include
Off
Off
always_populate_raw_post_data
Off
Off
arg_separator.input
&
&
arg_separator.output
&
&
asp_tags
Off
Off
auto_append_file
no value
no value
auto_globals_jit
On
On
auto_prepend_file
no value
no value
browscap
/etc/browscap.ini
/etc/browscap.ini
default_charset
no value
no value
default_mimetype
text/html
text/html
define_syslog_variables
Off
Off
disable_classes
no value
no value
disable_functions
leak,posix_getpwuid,posix_getpwnam,posix_getgrid,posix_getgrnam,posix_getgroups
leak,posix_getpwuid,posix_getpwnam,posix_getgrid,posix_getgrnam,posix_getgroups
display_errors
Off
Off
display_startup_errors
Off
Off
doc_root
no value
no value
docref_ext
no value
no value
docref_root
no value
no value
enable_dl
Off
Off
error_append_string
no value
no value
error_log
/mnt/Target01/337846/945285/www.dermerrealestate.com/logs/php_errors.log
no value
error_prepend_string
no value
no value
error_reporting
30711
30711
exit_on_timeout
Off
Off
expose_php
Off
Off
extension_dir
/usr/lib64/php/modules
/usr/lib64/php/modules
file_uploads
On
On
highlight.bg
#FFFFFF
#FFFFFF
highlight.comment
#FF8000
#FF8000
highlight.default
#0000BB
#0000BB
highlight.html
#000000
#000000
highlight.keyword
#007700
#007700
highlight.string
#DD0000
#DD0000
html_errors
On
On
ignore_repeated_errors
Off
Off
ignore_repeated_source
Off
Off
ignore_user_abort
Off
Off
implicit_flush
Off
Off
include_path
.:/usr/share/pear:/usr/share/php
.:/usr/share/pear:/usr/share/php
log_errors
On
On
log_errors_max_len
1024
1024
magic_quotes_gpc
On
On
magic_quotes_runtime
Off
Off
magic_quotes_sybase
Off
Off
mail.add_x_header
On
On
mail.force_extra_parameters
no value
no value
mail.log
no value
no value
max_execution_time
30
30
max_file_uploads
20
20
max_input_nesting_level
64
64
max_input_time
60
60
max_input_vars
1000
1000
memory_limit
128M
128M
open_basedir
no value
no value
output_buffering
no value
no value
output_handler
no value
no value
post_max_size
8M
8M
precision
14
14
realpath_cache_size
4M
4M
realpath_cache_ttl
120
120
register_argc_argv
On
On
register_globals
Off
Off
register_long_arrays
On
On
report_memleaks
On
On
report_zend_debug
On
On
request_order
no value
no value
safe_mode
Off
Off
safe_mode_exec_dir
no value
no value
safe_mode_gid
Off
Off
safe_mode_include_dir
no value
no value
sendmail_from
no value
no value
sendmail_path
/usr/sbin/sendmail -t -i
/usr/sbin/sendmail -t -i
serialize_precision
100
100
short_open_tag
On
On
SMTP
localhost
localhost
smtp_port
25
25
sql.safe_mode
Off
Off
track_errors
Off
Off
unserialize_callback_func
no value
no value
upload_max_filesize
8M
8M
upload_tmp_dir
/tmp
/tmp
user_dir
no value
no value
user_ini.cache_ttl
300
300
user_ini.filename
.user.ini
.user.ini
variables_order
EGPCS
EGPCS
xmlrpc_error_number
0
0
xmlrpc_errors
Off
Off
y2k_compliance
On
On
zend.enable_gc
On
On
Hey, Im needing some help with an update form that I have created using PHP/MySQL. Basically the form is working great (updating records, retrieving records and showing errors) but there is a problem with the errors. If there are no errors and I edit the existing text input values, the database updates fine. However if I edit the existing text input values and there is an error, the edited input values dont save, they revert back to the values of the database. I understand why this is happening, its because the text inputs are set to show the values of the database so if i edit the existing values and an error occurs or the page is refreshed, the values revert back to the database values. However id like it so that if any text in the text field have been edited and an error occurs, the text stays to how it is until the user by passes any errors and then the database is updated. Hopefully this makes sense. I have attached the php page just incase anybody wants to look into it but any help would be much appreciated! Also, im not looking for someone to just to fix this for me but if someone knows my problem and can guide me in the right direction, that would be great. I have a form where users can send comments. The form sends the comments to me via e-mail. Why is the e-mail field not staying "sticky" after I click "Submit" yet the other fields are?? Code: [Select] <form id="comments" action="" method="post"> <ul> <!-- Sender's Email --> <li> <label for="senderEmail">Your E-mail:</label> <input id="senderEmail" name="senderEmail" class="text" type="text" maxlength="40" value="<?php if(isset($senderEmail)){echo htmlspecialchars($senderEmail, ENT_QUOTES);} ?>" /><!-- Sticky Field --> <?php if (!empty($errors['senderEmail'])){ echo '<span class="error">' . $errors['senderEmail'] . '</span>'; } ?> </li> <!-- Subject Line --> <li> <label for="subject">Subject:</label> <input id="subject" name="subject" class="text" type="text" maxlength="80" value="<?php if(isset($subject)){echo htmlspecialchars($subject, ENT_QUOTES);} ?>" /><!-- Sticky Field --> <?php if (!empty($errors['subject'])){ echo '<span class="error">' . $errors['subject'] . '</span>'; } ?> </li> Debbie Hi i have this edit form that allows user to mofy data but the problems on the text box is that it deletes the rest of the data after the space from the first word i tried to increase the size of the varChars on mysql but did no work why it happens how can i stop from happening?? this the form input <input type="text" name="name" id="name" class='text_box' value="<?php echo $_GET['name'];?>"/> Hi there. How do I reflect the text content of the variable $a in this text form: <input type="text" name="artist"> Regards Morris Hi all, i need some help in retaining the values in an <option> textbox.. I have found a code to loop the date online, and use it for Javascript jump menu, but i have no ideas how to retain the option.. here are my codes(in red), $year1 = date('Y'); $month1 = date('m'); $day1 = date('j'); $day1 = $day1 + 1; $year2 = date('Y') + 2; $month2 = date('m'); $day2 = date('j'); $start_date = "$year1-$month1-$day1"; $end_date = "$year2-$month2-$day2"; $date = mktime(0,0,0,$month1,$day1,$year1); //Gets Unix timestamp START DATE $date1 = mktime(0,0,0,$month2,$day2,$year2); //Gets Unix timestamp END DATE $difference = $date1-$date; //Calcuates Difference $daysago = floor($difference /60/60/24); //Calculates Days Old $i = 0; while ($i <= $daysago +1) { if ($i != 0) { $date = $date + 86400; } else { $date = $date - 86400; } $yy1 = date('Y',$date); $mm1 = date('m',$date); $dd1 = date('d',$date); $date3 = "$yy1-$mm1-$dd1" ; echo "<option value=\"test1234.php?m=$mm1&y=$yy1&d=$dd1\" "; echo ">".$date3 ."</option>"; $i++; } i know that i have to something selected, but i dun understand how this set of date code loop which left me helpless. Does anyone have suggestions on how the following can be accomplished? Objective: I need a method to grab the {$email} variable from from via $_GET and populate (display) that variable string in the textbox of the form. Example: http://domain.com?email=john.smith@abc.com Code: [Select] <form action='index.php' method='post' name='emailForm' id="emailForm"> <div><input type='text' name='email' id="emailBox" size="40" value='<?php echo $_POST[email]; ?>' /></div> <div><input type='submit' name='frm2' class="button2" value='submit'/> Right now, the email (captured string) variable will show once the form is submitted (based on the "POST" function but i want to be able to capture and immediately insert the email address - if provided in the top URL on initial load. Is there a way to accomplish this with PHP or do I need JavaScript? I have a PHP Form where users have to enter and upload a file but when they click upload everything is working except that it is only sending first character of text field to Database! Can any one help?? Thanks File upload.php form Code: [Select] <form action="add_file.php" method="post" enctype="multipart/form-data"> <p><br> JobID: <input name="JobID" type="text" value="<?php echo $row_Recordset1['JobID']; ?>" readonly="readonly" /> </p> <p>Company ID: <input name="CompanyID" type="text" value="<?php echo $row_Recordset1['CompanyID']; ?>" readonly="readonly" /> </p> <p>UserID: <input name="UsersID" type="text" /> </p> <p>Select File to upload: <input type="file" name="uploaded_file" /> </p> <p>Make Sure All Details Are Correct before Submitting!</p> <p> <input type="submit" value="Submit Application" /> </p> <form> add_file.php // Check if a file has been uploaded if(isset($_FILES['uploaded_file'])) { // Make sure the file was sent without errors if($_FILES['uploaded_file']['error'] == 0) { // Connect to the database $dbLink = new mysqli('localhost', 'user', 'password', 'phpsite'); if(mysqli_connect_errno()) { die("MySQL connection failed: ". mysqli_connect_error()); } // Gather all required data $JobID = $dbLink->real_escape_string($_POST['JobID']['JobID']); $CompanyID = $dbLink->real_escape_string($_POST['CompanyID']['CompanyID']); $UsersID = $dbLink->real_escape_string($_POST['UsersID']['UsersID']); $name = $dbLink->real_escape_string($_FILES['uploaded_file']['name']); $mime = $dbLink->real_escape_string($_FILES['uploaded_file']['type']); $data = $dbLink->real_escape_string(file_get_contents($_FILES ['uploaded_file']['tmp_name'])); $size = intval($_FILES['uploaded_file']['size']); // Create the SQL query $query = " INSERT INTO `application` ( `JobID`, `CompanyID`, `UsersID`, `name`, `mime`, `size`, `data`, `N_DateAndTime` ) VALUES ( '{$JobID}', '{$CompanyID}', '{$UsersID}', '{$name}', '{$mime}', {$size}, '{$data}', NOW() )"; // Execute the query $result = $dbLink->query($query); // Check if it was successfull if($result) { echo 'Success! Your job application was successfully sent!'; } else { echo 'Error! Failed to insert the file, please try again' . "<pre>{$dbLink->error}</pre>"; } } else { echo 'An error accured while the file was being uploaded, please try again. ' . 'Error code: '. intval($_FILES['uploaded_file']['error']); } // Close the mysql connection $dbLink->close(); } else { echo 'Error! A file was not sent! Please try again!'; } // Echo a link back to the main page echo '<p>Click <a href="year1index.php">here</a> to go back</p>'; ?> MOD EDIT: [code] . . . [/code] BBCode tags added. (Another quite newbie...) I have already an online booking form. The Form works fine now and I would like to add on one more issue, but the code ignores what I want to check. I have 4 fields: arrival, departure, no. of persons and comments to check. Scenario 1: All field mentioned above are emtpty: Workes fine and message appears: "You have not provided any booking details". Scenario 2: If arrival (date_start) and departure (date_end) is entered, there should be at least an entry either in the field "comment", or in the field "pax". If not, there should be a message: "You have not provided sufficient booking details". INSTEAD: The booking request is sent, which should not be the case. The code is currently: # all fields empty : arrival, departure, pax and comments - error if(empty($data_start) && empty($data_end) && empty($pax)&& empty($comment)){ exit("You have not specified any booking details to submit to us. <br>Please use your browser to go back to the form. <br>If you experience problems with this Form, please e-mail us"); exit; } #If arrival and departure date is entered, there should be at least an entry either in the field "comment", or in the field "pax". if(!isset($data_start) && !isset($data_end) && empty($pax) && empty($comment)){ exit("You have not provided sufficient booking details. <br>Please use your browser to go back to the form. <br>If you experience problems with this Form, please e-mail us"); exit; } The form can be tested at http://www.phuket-beachvillas.com/contact-own/contact-it.php Can someone please check and tell me what's wrong with the code ? Thanks to anyone for any hint. Ok from one brick wall to the next. After lots of help with my last query I moved onto the next task an I'm completely stuck again. I have a form thats created with a loop. Here is that form <form action="" method="post" id=""> <?php for ($i = 1; $i <= $totalRows_rs_cacheNum; $i++) { echo "<label>Cache ".$i."</label> <span id='sprytextfield".$i."'> <input name='cache[$i]' type='text' value='".$_POST['cache[$i]']."'/> <span class='textfieldRequiredMsg'>Required!</span></span> <div class='clear'></div>"; } ?> <input name="nextbtn" type="submit" value="Next" /> When a user enters data in all the fields, If one piece of information is incorrect an error pops up saying one of the fields you entered does not match the fields in the database. At the same time however i wish to keep the data they have entered in each of the fields. Normally you'd just write value="<?php echo $_POST['fieldName'];?>" but for some reason in this case it does not work. can someone point me in the right direction. I've tried Google many different terms but I can not find the correct term to find my answer. Hence me asking you guys again. Thanks This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=319994.0 Hello All,
Being a newbie at PHP coding I'm at my wits end trying to figure out:
a) how to pull-in values from a delimeted text field (in a MySQL table) and check/select the appropriate checkboxes, based on the values that were stored in the text field,
b) how to write any changes (made by the user) back to the tables' text field.
Note that this is for an "update.php" file/process.
My "create.php" file/process uses the following HTML to display and accept the checkbox values:
<div class="control-group"> <label class="control-label">Limited Time Sale Days:</label> <div class="lts-checkboxes-container"> <label class="indent-to-the-left"> <input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='F'><span class='no-highlight'>Fri</span> </label> <label><input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='Sa'><span class='no-highlight'>Sat</span></label> <label><input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='Su'><span class='no-highlight'>Sun</span></label> <label><input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='M'><span class='no-highlight'>Mon</span></label> <label><input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='Tu'><span class='no-highlight'>Tue</span></label> <label><input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='W'><span class='no-highlight'>Wed</span></label> <label><input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='Th'><span class='no-highlight'>Thu</span></label> </div> </div>And the code (certainly not the best code in the world, but it works) to collect, delemit/concatenate, and save to DB is as follows: if(empty($_POST['limited_time_sale'])) { // echo("You didn't select any weekday."); $selected_lts = ''; $limited_time_sale = ''; } else { $limited_time_sale = $_POST['limited_time_sale']; $N = count($limited_time_sale); $selected_lts = ''; // echo("You selected $N DoW(s): "); for($i=0; $i < $N; $i++) { // echo($limited_time_sale[$i] . " "); if ($i < ($N - 1)) { $selected_lts .= $limited_time_sale[$i] . "-"; } else { $selected_lts .= $limited_time_sale[$i]; } } } if(!empty($selected_lts)) { $limited_time_sale = $selected_lts; }Now, I've figured out how to bring-in, and separate the stored values using the following code, however I have no idea what to do next...in order to have only the approprite boxes checked/selected (in the event that all boxes were not selected during the create stage). $limited_time_sale = isset($values['limited_time_sale']) ? $values['limited_time_sale'] : ''; $checked_lts = explode("-", $limited_time_sale);In my "update.php" file, the HTML for the forms' checkboxes is as follows: <div class="control-group"> <label class="control-label">Limited Time Sale Days:</label> <div class="lts-checkboxes-container"> <label class="indent-to-the-left"> <input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='F' <?php echo $lts1; ?>><span class='no-highlight'>Fri</span> </label> <label><input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='Sa' <?php echo $lts2; ?>><span class='no-highlight'>Sat</span></label> <label><input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='Su' <?php echo $lts3; ?>><span class='no-highlight'>Sun</span></label> <label><input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='M' <?php echo $lts4; ?>><span class='no-highlight'>Mon</span></label> <label><input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='Tu' <?php echo $lts5; ?>><span class='no-highlight'>Tue</span></label> <label><input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='W' <?php echo $lts6; ?>><span class='no-highlight'>Wed</span></label> <label><input class='lts-checkbox' type='checkbox' name='limited_time_sale[]' value ='Th' <?php echo $lts7; ?>><span class='no-highlight'>Thu</span></label> </div> </div>Attached picture shows that selected checkboxes are saved to the text field as/in the format of "F-Sa-Su-M-Tu-W-Th" - if all checkboxes/weekdays were selected....or as "Sa-M-W-Th" - if only Sat, Mon, Wed, and Thu checkboxes were selected Thanks. Attached Files checkbox-Question.png 403.99KB 0 downloads This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=334042.0 How to do it? I have read some methods but they seem to not work. This is what I have got so far:
<?php Hi I have a list of states using the array method in a form. The drop down menu works fine. I want to save the user choice,if the form is re-displayed due to a blank field or pattern mismatch. I know I can use the selected=selected, but don't know wher to put the statement: My array is: state_province = array ("list of states", "provinces") Var in my labels array is "state"=>"state" Here is my code for the select/option statement: { if($field == "state") { echo "<div class='province_state'><label for='state' size='10'>* Province/State</label><select>"; foreach($state_province as $state) { echo "\n<option value='$state_province' /> "; echo $state ; echo "</option>"; } echo "</select></div>\n"; } ?Is this the correct code to add and where would I add it? if(@$_POST['state'] == $value) { echo "selected='selected' "; } |