PHP - How To Get Form Field With Php?
I am trying to find this form field "form_key" on tumblr.com
If you view source on: http://www.tumblr.com/dashboard On firefox it shows this: Code: [Select] <form style="width:0px; height:0px; overflow:hidden; position:absolute;" method="post" action="/set_avatar" id="set_avatar_form" enctype="multipart/form-data"> <input type="hidden" name="form_key" value="jg351pzpvzMSkyJIZZhkT7AfcQ"/> <input type="file" name="set_avatar" id="set_avatar" onchange="$('set_avatar_form').submit();"/> <input type="hidden" name="redirect_to" value="/dashboard"/> </form> But when I use php's file_get_content("http://www.tumblr.com/dashboard"); That data is no where to be found. Any idea how I can get that form data in my php file? For example I am trying to use regex preg_match_all to extract the form_key, but get_file_contents doesnt show the <form></form> Similar TutorialsI have read around and can't seem to find the right coding for what I need on this forum and some other other forums. I have a contact form (as listed below) and I need 2 locations (Print Name and Title) fields to auto-populate on a separate form (can be a doc, pdf, etc. any form of document which is easiest) and this form can be totally back end and the individual using the form never is going to see the form. It's going on a contract form, that we would like to auto-populate. Also is there a simple attachment code so individuals can attach documents to the code? <p style: align="center"><form action="mailtest.php" method="POST"> <?php $ipi = getenv("REMOTE_ADDR"); $httprefi = getenv ("HTTP_REFERER"); $httpagenti = getenv ("HTTP_USER_AGENT"); ?> <input type="hidden" name="ip" value="<?php echo $ipi ?>" /> <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" /> <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" /> <div align="center"> <p class="style1">Name</p> <input type="text" name="name"> <p class="style1">Address</p> <input type="text" name="address"> <p class="style1">Email</p> <input type="text" name="email"> <p class="style1">Phone</p> <input type="text" name="phone"> <p class="style1">Debtor</p> <input type="text" name="debtor"> <p class="style1">Debtor Address</p> <input type="text" name="debtora"> <br /> <br /> <a href="authoforms.php" target="_blank" style="color:#ffcb00" vlink="#ffcb00">Click here to view Assignment Agreement and Contract Agreement</a> <p class="style1"><input type='checkbox' name='chk' value='I Have read and Agree to the terms.'> I have read and agree to the Assignment and Contract Agreement <br></p> <p class="style1">Print Name</p> <input type="text" name="pname"> <p class="style1">Title</p> <input type="text" name="title"> <p class="style1">I hear by agree that the information I have provided is true, accurate and the information I am submitting is <br /> not fraudulent. Please click the agree button that you adhere to Commercial Recovery Authority Inc.'s terms:</p> <select name="agree" size="1"> <option value="Agree">Agree</option> <option value="Disagree">Disagree</option> </select> <br /> <br /> <p class="style1">Employee ID:</p> <input type="text" name="employee"> <br /> <input type="submit" value="Send"><input type="reset" value="Clear"> </div> </form> </p> The mailtest php is this ?php $ip = $_POST['ip']; $httpref = $_POST['httpref']; $httpagent = $_POST['httpagent']; $name = $_POST['name']; $address = $_POST['address']; $email = $_POST['email']; $phone = $_POST['phone']; $debtor = $_POST['debtor']; $debtora = $_POST['debtora']; $value = $_POST['chk']; $pname = $_POST['pname']; $title = $_POST['title']; $agree = $_POST['agree']; $employee = $_POST['employee']; $formcontent=" From: $name \n Address: $address \n Email: $email \n Phone: $phone \n Debtor: $debtor \n Debtor's Address: $debtora \n 'Client' has read Assignment and Contract Agreement: $value \n Print Name: $pname \n Title: $title \n I hear by agree that the information I have provided is true, accurate and the information I am submitting is not fraudulent. Please click the agree button that you adhere to Commercial Recovery Authority Inc.'s terms: $agree \n \n Employee ID: $employee \n IP: $ip"; $recipient = "mail@crapower.com"; $subject = "Online Authorization Form 33.3%"; $mailheader = "From: $email \r\n"; mail($recipient, $subject, $formcontent, $mailheader) or die("Error!"); echo "Thank You!" . " -" . "<a href='index.php' style='text-decoration:none;color:#ffcb00;'> Return Home</a>"; $ip = $_POST['visitoraddress'] ?> 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 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> Hello, Please can someone tell me how to create a form field suggestion box (like to box of suggestions that appears under the google search bar)? Many thanks, Stu can u make a form field not copyable. I have the following field. but i do not want users to able to copy and paste it.. <input type="text" size="40" name="security_code" value="72o936GRWD" readonly=""> I have been toying around with form validation and have got to a sticking point in four areas that I am pretty sure are easier to do than I am finding! What I have so far works fine - once you start typing in a field, if it is invalid, then there is a message and some extra styling that is removed once it is valid. These are the functions for the four fields so far (there will be more, some required, some not). $('#username').on('keyup', function(){ var valid = /^[a-zA-Z0-9_-]{3,16}$/.test(this.value) && this.value.length; $('#regUsername .regAlert').html((valid?'':'Not Valid')); if(!valid){ $("#regUsername").addClass('bg-danger'); }else{ $("#regUsername").removeClass('bg-danger'); } }); $('#email').on('keyup', function(){ var valid = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/.test(this.value) && this.value.length; $('#regEmail .regAlert').html((valid?'':'Not Valid')); if(!valid){ $("#regEmail").addClass('bg-danger'); }else{ $("#regEmail").removeClass('bg-danger'); } }); $('#password').on('keyup', function(){ var valid = (/^(?=.*\d)(?=.*[a-zA-Z])[0-9a-zA-Z]{6,}$/).test(this.value) && this.value.length; $('#regPassword .regAlert').html((valid?'':'Not Valid')); if(!valid){ $("#regPassword").addClass('bg-danger'); }else{ $("#regPassword").removeClass('bg-danger'); } }); $('#password_confirm').on('keyup', function(){ var valid = (/^(?=.*\d)(?=.*[a-zA-Z])[0-9a-zA-Z]{6,}$/).test(this.value) && this.value.length; $('#regPassword2 .regAlert').html((valid?'':'Not Valid')); if(!valid){ $("#regPassword2").addClass('bg-danger'); }else{ $("#regPassword2").removeClass('bg-danger'); } }); What I am trying to do next is, if any of these fields are not valid, for the submit button to be disabled I can do by including if(!valid){ $('#registerSubmit').prop('disabled', true); }else{ $('#registerSubmit').prop('disabled', false); }in each function BUT if one is invalid, but the next is valid, then this overrides it and the button is clickable again. I have also tried setting a variable to true/false and the same happens. Plus, if all are valid, once the button is clicked, it needs to check for empty (required) fields and only submit if all fields have data. I am also guessing that they is a better way of writing this using a single keyup function and then placing each fields rules within that, but I have tried to wrap it all in a single function but got more in a mess. So, what I am looking for help with (bearing in mind there will be more fields, radio's, checkboxes and selects in the full form) is How can I streamline all of the functions into one to save on repeated code and to make it simple to add more fields in future How can I disable the submit button if ANY of the validations have failed How can I check for any empty required fields on submit button click and not process the form if any are found How can I check that #password and #password_confirm match on keyup from #password_confirm Thanks in advance for any advice Steve Hey all. What is the best way to check if a form field has been entered by the user? Because a field left blank by the user still shows up as set with the isset function. Example: if (isset($_POST['name'])) { echo "The field is set"; } This is a problem if I'm checking if the user has skipped over the name field on a form because an empty value gets passed to the POST array even if the field is left blank. Do people use empty or a regular expression instead? Cheers! I have this php file that processes Form field entries. Apparently I need to modify it, I'm told, to "validate the input and then send some response back": <?php if($_POST){ $to = 'chrisj...@.....com'; $subject = 'Thank you for your info'; $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $message1 = $_POST['message']; $headers = $name; $headers = 'from: info@.....com'; $message1 .= "\r\n\r\nName: ".$_POST['name']." \r\n Email: ".$_POST['email']." "; $message = "Hello {$_POST['name']}, ~ Thank you for your input\r\n\r\n"; mail( $to, $subject, $message1, $headers ); mail( $email, $subject, $message, $headers ); header('Location: https://....'); exit; } ?> The corresponding js looks like this: $.ajax({ url: 'https://...../submit.php', method: 'post', data: { name: $('#name').val(), email: $('#email').val() }, success: function (response) { console.log(response); if (response.success) { alert('Success'); } else { alert('Error'); } } }); I look forward to any guidance with adding "validate the input and then send some response back".
Hi People. I am building a logbook application and have a form field where the user will enter a date. However, I would like to simplify it for the user and give them a button which would add "todays" date into the box for them. Please could someone tell me the code to do so. The date format in my DB is YYYY-MM-DD. The form would also need to take input from the user if they were adding info from a different day instead of today. Thanks in advance. Code: [Select] <input type="text" name="date" id="date" size = "25"/> </label> <input type="submit" name="today" id="today" value="Add Today" /> Hi i have a form that logins at a mail. I have installed an SSL at this domain and i would like to add an option at the form for the user to login using https or not the form is above. How can i add an option with check-box from user to login using https ???? IF this is checked when the user clicks "login" he will redirected to https and will login. If i have not describe well please ask for details. Thanks <form class="login-form" action="<?php echo $this->moduleBaseUrl; ?>/XXX/XXXXXX" name="loginPage" id="loginPage" method="post"> <input type='hidden' name='emailName' value=''/> <input type='hidden' name='emailDomain' value=''/> <input type='hidden' name='cssStyle' value='<?php echo $this->cssStyle ?>'/> <table class="login"> <tbody> <tr> <td> <label class="user"><?php print $this->translate('Email') ?>:</label> <input id="email" class="input-email" type="text" name="email" tabindex="1" /> </td> </tr> <tr> <td> <label class="pass"><?php print $this->translate('Password') ?>:</label> <input id="password" class="input-pass" type="password" name="password" tabindex="2" /> </td> </tr> <tr id="LoginBtn" style="display: none;"> <td> <input class="loginbtn <?php echo $this->cssStyle ?>" type="submit" value="<?php print $this->translate('Login') ?>" /> <span class="remember"><?php print $this->translate('Remember Me') ?></span> <input class="check" type="checkbox" value="1" name="RememberMe" /> </td> </tr> </tbody> </table> </form> I've been trying to make my contact form engine mandatory for the name, phone number and email fields, but when I upload it on the ftp and test it, I keep getting errors. Here's the code I have that is working without the fields being mandatory: <?php $EmailFrom = "example@gmail.com"; $EmailTo = "example@gmail.com"; $EmailTo = "example@gmail.com"; $EmailTo = "example@gmail.com"; $Subject = "New Lead!!!"; $Name = Trim(stripslashes($_POST['Name'])); $Phone_Number = Trim(stripslashes($_POST['Phone_Number'])); $Email = Trim(stripslashes($_POST['Email'])); $Message = Trim(stripslashes($_POST['Message'])); // validation $validationOK=true; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; exit; } // prepare email body text $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Phone Number: "; $Body .= $Phone_Number; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; $Body .= "Message: "; $Body .= $Message; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success) {//&& ($Phone_Number != "" || $Email != "") { print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; } ?> I would like it to return something that says: "Enter Your Name/Phone Number/Email" corresponding to the appropriate field they didn't fill out. Thanks for any input you can provide! 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 form which is working, but the client wanted to add a recapatcha field so I am implementing that and placed the recaptcha code in the same directory as my form. The recaptcha displays, but you can enter in anything and the form still submits, so it's not doing any good! Not sure where the problem lies exactly, but was hoping for some help if someone has experienced anything similar. here is my code in the html Code: [Select] <li> <pre> <script> var RecaptchaOptions = { theme : 'clean' }; </script> </pre> <?php require_once('../ContactUs/recaptchalib.php'); $publickey = "6LdZX8ASAAAAABUejj-bfZey47TTjN6X-EKfKBwy "; // you got this from the signup page echo recaptcha_get_html($publickey); ?> </li> the PHP to submit the Post data <?php if(!$_POST) exit; $email = $_POST['email']; if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email )){ $error.="Invalid email address entered"; $errors=1; } if($errors==1) echo $error; else{ $values = array ('name','email','phone','concerning','message','recaptcha_response_field'); $required = array('name','email','message','recaptcha_response_field'); $your_email = "email@email.com"; $email_subject = "New Message from our web site!"; $email_content = "new message:\n"; foreach($values as $value){ if(in_array($value,$required)){ if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; } $email_content .= $value.': '.$_POST[$value]."\n"; } } if(mail($your_email,$email_subject,$email_content)) { echo 'Your message has been successfully sent!'; } else { echo 'ERROR! please try again or use the email address listed above to contact Sandbox-Band'; } } ?> the recaptchalib.php file is exactly as I downloaded it from their site. I have one field which is set up as a Text field in my database. What I'm wanting is if the field is blank in the form to just leave the field alone in the database. I need it to be NULL. OR...is there a way to query a database to recognize a field is blank? Hi there, I was wondering if it was possible to change a forms action field with PHP. Basically, if there are several checkboxes for the user to select and a specific checkbox was selected, how would I redirect users to an alternative webpage on submit? I've been playing around with several methods, and one of them was: Code: [Select] <?php if(isset($_POST['Example']) && $_POST['Example'] == 'FormValueGoesHere') { echo ('./page1.php'); } else { echo ('./page2.php'); } ?> But the form action would only display page1.php even with nothing selected. Maybe I'm just being stupid because it's getting late, but I'd appreciate any assistance. Thanks Hi there! I am wondering if anyone knows how to handle strings that contain form fields, so when the form is submitted the fields inside the string are updated. For example say i have the following $string: Code: [Select] please enter your username: <input type=text size=50 name=username value=" "> When I display it on the browser, inside of a form, it displays the blank text field. Say the user enters a value in the text field, "John", and hits submit. I need the $string to be updated to the following: Code: [Select] please enter your user name: <input type=text size=50 value="John"> I know it sounds wierd but I need the form to be inside of the string! Thanks in advance for any help! Hiya pplz. I am trying to add: class="keyboardInput" to activate a javascript script to an input box. This is the line im trying to add it to: <td><?php echo form_input(array('name'=>'quantity','value'=>$item['quantity'],'size'=>'2'));?></td> I have tried: <td><?php echo form_input(array('name'=>'quantity','value'=>$item['quantity'],'size'=>'2'));? class="keyboardInput"></td> didn't work. Any help would be great. Ian Hi Guys I have built a simple form, which has text fields Name, Telephone Number, Best Time to Call and E-mail. For security purposes, I am testing each against the function shown below which looks for dangerous code snippets, in an effort to protect against email header injection attacks. When it comes to the E-mail field, I am not actually testing whether a valid e-mail address has been entered, as it is the telephone number which is essential, not the e-mail. My question is, do you think this is a security weakness? Many thanks Code: [Select] //http://www.tonyspencer.com/2005/12/15/email-injection-exploit-through-a-php-contact-form/ //preg_match string to match goes within forward slashes, i.e. /str/, and i at the end makes it case insensitive function containsInjectionAttempt($input) { if (preg_match("/\r/i", $input) || preg_match("/\n/i", $input) || preg_match("/%0a/i", $input) || preg_match("/%0d/i", $input) || preg_match("/Content-Type:/i", $input) || preg_match("/<script>/i", $input) || preg_match("/bcc:/i", $input) || preg_match("/to:/i", $input) || preg_match("/cc:/i", $input)) { return true; } else { return false; } } Hi, Newbie! I need to generate a unique number and put it in a field called "intInstD" value ="123456" to send to Paypoint to initiate an order. They insist each order from my website has a unique number. Can anyone help with a bit of code that does this please? Much appreciated zzdave |