PHP - Submit Form And: Upload Csv And Form Fields Into Mysql Db
Hi-
the code below lets me upload a CSV file to my database if I have 1 field in my database and 1 column in my CSV. I need to add to my db "player_id" from the CVS file and "event_name" and "event_type" from the form... any ideas??? here's the code: Code: [Select] <?php $hoststring =""; $database = ""; $username = ""; $password = ""; $makeconnection = mysql_pconnect($hoststring, $username, $password); ?> <?php ob_start(); mysql_select_db($database, $makeconnection); $sql_get_players=" SELECT * FROM tabel ORDER BY player_id ASC"; // $get_players = mysql_query($sql_get_players, $makeconnection) or die(mysql_error()); $row_get_players = mysql_fetch_assoc($get_players); // $message = null; $allowed_extensions = array('csv'); $upload_path = '.'; //same directory if (!empty($_FILES['file'])) { if ($_FILES['file']['error'] == 0) { // check extension $file = explode(".", $_FILES['file']['name']); $extension = array_pop($file); if (in_array($extension, $allowed_extensions)) { if (move_uploaded_file($_FILES['file']['tmp_name'], $upload_path.'/'.$_FILES['file']['name'])) { if (($handle = fopen($upload_path.'/'.$_FILES['file']['name'], "r")) !== false) { $keys = array(); $out = array(); $insert = array(); $line = 1; while (($row = fgetcsv($handle, 0, ',', '"')) !== FALSE) { foreach($row as $key => $value) { if ($line === 1) { $keys[$key] = $value; } else { $out[$line][$key] = $value; } } $line++; } fclose($handle); if (!empty($keys) && !empty($out)) { $db = new PDO( 'mysql:host=host;dbname=db', 'user', 'pw'); $db->exec("SET CHARACTER SET utf8"); foreach($out as $key => $value) { $sql = "INSERT INTO `table` (`"; $sql .= implode("`player_id`", $keys); $sql .= "`) VALUES ("; $sql .= implode(", ", array_fill(0, count($keys), "?")); $sql .= ")"; $statement = $db->prepare($sql); $statement->execute($value); } $message = '<span>File has been uploaded successfully</span>'; } } } } else { $message = '<span>Only .csv file format is allowed</span>'; } } else { $message = '<span>There was a problem with your file</span>'; } } ob_flush();?> <!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="text/html; charset=UTF-8" /> <title>CSV File Upload</title> </head> <body> <form class="form" action="" method="post" enctype="multipart/form-data"> <h3>Select Your File</h3> <p><?php echo $message; ?></p> <input type="file" name="file" id="file" size="30" /> <br/> <label>Event Name:</label><input name="event_name" type="text" value="" /> <br/> <label>Event Type:</label><input name="event_type" type="text" value="" /> <br/> <input type="submit" id="btn" class="button" value="Submit" /> </form> <br/> <h3>Results:</h3> <?php do { ?> <p><?php echo $row_get_players['player_id'];?></p> <?php } while ($row_get_players = mysql_fetch_assoc($get_players)); ?> </body> </html> Similar TutorialsHello, I'm using the following code to echo what fields have been left blank: if(isset($_POST['submit'])) { $emailconfirm = $_POST['emailconfirm']; $name = trim($_POST['name']); $visitor_email = trim($_POST['email']); $user_message = trim($_POST['message']); if(empty($name)){ $name1 .= "<br>Name is empty."; } if(empty($visitor_email)){ $email1 .= "<br>Email is empty."; } if(empty($user_message)){ $message1 .= "<br>User Message is empty."; } But what seems to happen, is once you submit the form with blank fields, the echo does show, however, when you click submit again, the form submits even though the fields were blank. Is their a way of blocking 'post' if the fields are blank? Thanks I have an upload form (which can be seen he http://kmkwebdevelopment.com/formtest/upload.php). There are currently 5 "upload" fields, and I would like to have it so that if a person requires more "upload" fields, they can click on a + sign or something and it will make 15 more "upload" fields drop down (so they can upload a total of 20 files at a time). Does anyone know a good way to do this? Thanks. <?php error_reporting(0); foreach($_POST as $key => $value){ if (is_array($value)) { $_values[$key] = join("%,% ",$value); }else $_values[$key] = $value; $_values[$key]=stripslashes($_values[$key]); } if (!isset($_POST["_referer"])) { @$_referer = $_SERVER["HTTP_REFERER"]; }else $_referer = $_POST["_referer"]; $_ErrorList = array(); function mark_if_error($_field_name, $_old_style = ""){ global $_ErrorList; $flag=false; foreach($_ErrorList as $_error_item_name){ if ($_error_item_name==$_field_name) { $flag=true; } } echo $flag ? "style=\"background-color: #FFCCBA; border: solid 1px #D63301;\"" : $_old_style; } function IsThereErrors($form, $_isdisplay) { global $_POST, $_FILES, $_values, $_ErrorList; $flag = false; if ($form > -1) { if ($_isdisplay) { echo "<div style=\"border: 1px solid; margin: 10px auto; padding:15px 10px 15px 50px; background-repeat: no-repeat; background-position: 10px center; color: #D63301; background-color: #FFCCBA; max-width:600px; background-image:url('".$_SERVER["PHP_SELF"]."?image=warning');\">"; } $flag = false; $req[0][] = array("firstname", "firstname is required."); $req[0][] = array("lastname", "lastname is required."); $req[0][] = array("email", "email is required."); $req[0][] = array("companynumber", "companynumber is required."); foreach($req[$form] as $field){ if (!isset($_values[$field[0]]) or ($_values[$field[0]]=="")) { $flag = true; if ($_isdisplay) { echo $field[1]."<br>"; $_ErrorList[] = $field[0]; } } } $files_req[0][] = array("upload1", "upload1 is required."); foreach($files_req[$form] as $field){ if (@$_FILES[$field[0]]["name"]=="") { $flag = true; if ($_isdisplay) { echo $field[1]."<br>"; $_ErrorList[] = $field[0]; } } } $fields[0][] = array("email", '/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]{2,4}$/', true, "email should be valid e-mail address."); $fields[0][] = array("companynumber", '/^[-+]?\b[0-9]*\.?[0-9]+(?:[eE][-+]?[0-9]+)?\b$/', true, "companynumber should contain integer or floating point value only."); foreach($fields[$form] as $field){ if (!(preg_match($field[1],$_values[$field[0]])==$field[2]) && $_values[$field[0]]!=""){ $flag = true; if ($_isdisplay) { echo $field[3]."<br>"; $_ErrorList[] = $field[0]; } } } $files[0][] = array("upload1", "true", "true", "You are trying to upload file with not allowed extension.", "true", ""); $files[0][] = array("upload2", "true", "true", "", "true", ""); $files[0][] = array("upload3", "true", "true", "", "true", ""); $files[0][] = array("upload4", "true", "true", "", "true", ""); $files[0][] = array("upload5", "true", "true", "", "true", ""); foreach($files[$form] as $file){ $str = $file[1]; if (eval("if($str){return true;}")) { $_values[$file[0]] = $_FILES[$file[0]]["name"]; $dirs = explode("/","attachments//"); $cur_dir ="."; foreach($dirs as $dir){ $cur_dir = $cur_dir."/".$dir; if (!@opendir($cur_dir)) { mkdir($cur_dir, 0777);}} $_values[$file[0]."_real-name"] = "attachments/".date("YmdHis")."_".$_FILES[$file[0]]["name"]."_secure"; copy($_FILES[$file[0]]["tmp_name"],$_values[$file[0]."_real-name"]); @unlink($_FILES[$file[0]]["tmp_name"]); }else{ $flag=true; if ($_isdisplay) { //$ExtFltr = $file[2]; //$FileSize = $file[4]; if (!eval("if($file[2]){return true;}")){echo $file[3];} if (!eval("if($file[4]){return true;}")){echo $file[5];} $_ErrorList[] = $file[0]; } } } if ($_isdisplay) { echo "</div>"; } } return $flag; } function display_page_upload_form($_iserrors) { global $_values, $_referer;?> <html><SCRIPT LANGUAGE = "JavaScript"> var fields = { "companynumber" : ["companynumber", /^[-+]?\b[0-9]*\.?[0-9]+(?:[eE][-+]?[0-9]+)?\b$/, true, "Your Company Number should be entered with no spaces or hyphens."], "email" : ["email", /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]{2,4}$/, true, "Please ensure your email address is in a valid format."] }; var req = { "upload1" : ["upload1", "upload1 is required."], "companynumber" : ["companynumber", "company number is required."], "email" : ["email", "email is required."], "lastname" : ["lastname", "last name is required."], "firstname" : ["firstname", "first name is required."] }; var validate_form = true;function CheckForm(){HideAllErrors();if(!validate_form)return true;var LastErrorField=null;for(var i in fields){isError=ValidateField(fields[i][0],fields[i][1],fields[i][2],fields[i][3]);if(isError)LastErrorField=isError}for(var i in req){isError=isFilled(req[i][0],req[i][1]);if(isError)LastErrorField=isError}if(LastErrorField){LastErrorField.focus();return false}else return true}function ShowTooltip(type,field,message){var IE='\v'=='v';var container;if(!(container=document.getElementById('error_list'))){var container=(IE)?(document.createElement('<div name="error_list">')):(document.createElement('div'));container=document.createElement('div');container.setAttribute('id','error_list');document.body.appendChild(container)}if(!document.getElementById(field+'_tooltip')){var elem=(IE)?(document.createElement('<div name="myName">')):(document.createElement('div'));var elem2=(IE)?(document.createElement('<div name="myName2">')):(document.createElement('div'));div_id=field+'_tooltip';elem=document.createElement('div');elem.setAttribute('id',div_id);elem.className="fe-"+type+"-container";elem.onmouseover=function(){MoveDivToTop(this)};elem.onclick=function(){HideTooltip(this.id)};elem2=document.createElement('div');elem2.className="fe-"+type;elem2.innerHTML=message;parentField=document.getElementsByName(field);var f=0;while(parentField[f].type=='hidden')f++;with(elem.style){top=findPos(parentField[f])[0]+'px';left=findPos(parentField[f])[1]+parentField[f].offsetWidth+'px'}elem.appendChild(elem2);container.appendChild(elem)}}function ValidateField(name,rule,condition,message){fld=document.getElementsByName(name);var i=0;while(fld[i].type=='hidden')i++;if(!(((fld[i].value.match(rule)!=null)==condition)||(fld[i].value==""))){ShowTooltip('error',fld[i].name,message);return fld[i]}return null}function isFilled(name,message){fld=document.getElementsByName(name);var isFilled=false;var i=0;while(fld[i].type=='hidden')i++;var obj=fld[i];for(j=i;j<fld.length;j++){if((fld[j].type=='checkbox')||(fld[j].type=='radio')){if(fld[j].checked)isFilled=true}else{if(fld[j].value!="")isFilled=true}}if(isFilled){return null}else{ShowTooltip('error',name,message);return obj}}function FieldBlur(elemId){HideTooltip(elemId);fieldName=elemId.replace(/(\S{0,})_tooltip/,"$1");if(typeof fields[fieldName]!='undefined'){ValidateField(fields[fieldName][0],fields[fieldName][1],fields[fieldName][2],fields[fieldName][3])}if(typeof req[fieldName]!='undefined'){isFilled(req[fieldName][0],req[fieldName][1])}}function HideTooltip(elemId){var elem=document.getElementById(elemId);var parent=document.getElementById('error_list');if((elem)&&(parent))parent.removeChild(elem)}function HideAllErrors(){error_container=document.getElementById('error_list');if(error_container!=null){while(error_container.childNodes.length>0){error_container.removeChild(error_container.firstChild)}}}function MoveDivToTop(div_to_top){div_container=document.getElementById('error_list');for(i=0;i<div_container.childNodes.length;i++)div_container.childNodes[i].style.zIndex="998";div_to_top.style.zIndex="999"}function findPos(obj){var curleft=curtop=0;do{curleft+=obj.offsetLeft;curtop+=obj.offsetTop}while(obj=obj.offsetParent);return[curtop,curleft]} </SCRIPT> <style type="text/css"> .form_expert_style {display: none;}.fe-info,.fe-error{font:13px arial,helvetica,verdana,sans-serif;padding:2px;position:relative;top:-7px}.fe-error{border:solid 1px #d51007;background:#fbe3e4;color:#d51007}.fe-info{border:solid 1px #0187c5;background:#eff9ff;color:#0187c5}.fe-info-container,.fe-error-container{position:absolute;padding:0;border-left:8px solid transparent;-border-left:8px solid white;filter:progid:DXImageTransform.Microsoft.Chroma(color="white")}.fe-error-container{border-top:8px solid #d00}.fe-info-container{border-top:8px solid #0187c5} </style> <form class="uploadform" action="<?php echo $_SERVER["PHP_SELF"] ?>" method="post" enctype="multipart/form-data" onSubmit="return CheckForm(this);"> <?php IsThereErrors("0", $_iserrors); ?> <input type="hidden" name="_referer" value="<?php echo $_referer ?>"> <input type="hidden" name="_next_page" value="1"> <p class="form_expert_style"><input name="URL" type="text" value=""/></p> <table> <tr> <td>First Name *</td> <td><input type='text' size='30' name='firstname' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("firstname", "") ?> value="<?php echo isset($_values["firstname"]) ? htmlspecialchars($_values["firstname"]) : "" ?>"></td> </tr> <tr> <td>Last Name *</td> <td><input type='text' size='30' name='lastname' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("lastname", "") ?> value="<?php echo isset($_values["lastname"]) ? htmlspecialchars($_values["lastname"]) : "" ?>"></td> </tr> <tr> <td>E-mail *</td> <td><input type='text' size='30' name='email' onblur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("email", "") ?> value="<?php echo isset($_values["email"]) ? htmlspecialchars($_values["email"]) : "" ?>"></td> </tr> <tr> <td>Company Number *</td> <td><input type='text' size='30' name='companynumber' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("companynumber", "") ?> value="<?php echo isset($_values["companynumber"]) ? htmlspecialchars($_values["companynumber"]) : "" ?>"></td> </tr> <tr> <td>Upload *</td> <td><input class="image" type='file' size='30' name='upload1' onBlur="FieldBlur(this.name+'_tooltip')" <?php mark_if_error("upload1", "") ?>></td> </tr> <tr> <td>Upload</td> <td><input class="image" type='file' size='30' name='upload2'></td> </tr> <tr> <td>Upload</td> <td><input class="image" type='file' size='30' name='upload3'></td> </tr> <tr> <td>Upload</td> <td><input class="image" type='file' size='30' name='upload4'></td> </tr> <tr> <td>Upload</td> <td><input class="image" type='file' size='30' name='upload5'></td> </tr> <tr> <td> </td> <td><input type="submit" name="SubmitBtn" onClick="CheckForm1();" value="SUBMIT" /></td> </tr> </table> </form> </html> <?php } function display_thankyou() { global $_values, $_referer;?> <html> <p style="margin-top:100px; padding-bottom:300px;"><b>Thank you for your submission</b></p> </html> <?php } function display_default() { ?> <!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><title>Successful submission</title><link rel="shortcut icon" href="http://forms-expert.com/images/favicon.ico" /><style>html,body,form,fieldset{margin:0;padding:0}html,body{ height:100%}body{color:#000;background:#FFF;font-family:Tahoma,Arial,Helvetica,sans-serif;line-height:160%}body#bd{padding:0;color:#333;background-color:#FFF}body.fs4{font-size:12px}.componentheading{color:#4F4F4F;font-family:"Segoe UI","Trebuchet MS",Arial,Helvetica,sans-serif;font-weight:bold}small,.small{color:#666;font-size:92%}ul{list-style:none}ul li{padding-left:30px;background:url(../images/bullet-list.gif) no-repeat 18px 9px;line-height:180%}.componentheading{padding:0 0 15px 0;margin-bottom:0px;color:#4F4F4F;background:url(http://forms-expert.com/images/dot.gif) repeat-x bottom;font-size:250%;font-weight:bold}#ja-header{height:60px;position:relative;z-index:999;width:920px;margin:0 auto;clear:both}#ja-containerwrap,#ja-footer{width:920px;margin:0 auto;clear:both}#main-container{ min-height:100%; /*height:100%;*/ position:relative}#ja-footerwrap{clear:both;border-top:1px solid #CCC;margin-top:10px;background:url(../images/grad2.gif) repeat-x top; position:absolute; bottom:0; width:100%; height:60px}#ja-footer{padding:15px 0;position:relative}#ja-footer small{padding:4px 0 0 10px;float:left;display:block;color:#999;font-style:normal;line-height:normal}small.ja-copyright{position:absolute;right:10px}#ja-footer a{color:#666;text-decoration:none}#ja-footer a:hover,#ja-footer a:active,#ja-footer a:focus{color:#666;text-decoration:underline}#ja-footer ul{margin:4px 0 5px 10px;padding:0;float:left;background:url(http://forms-expert.com/images/vline.gif) no-repeat center right;line-height:normal}#ja-footer li{margin:0;padding:0;display:inline;background:none}#ja-footer li a{padding:0 10px;display:inline;background:url(http://forms-expert.com/images/vline.gif) no-repeat center left;font-size:92%;line-height:normal}.clearfix:after{clear:both;display:block;content:".";height:0;visibility:hidden}* html >body .clearfix{width:100%;display:block}* html .clearfix{height:1%}/* Firefox Scrollbar Hack - Do not remove *//*html{margin-bottom:1px;height:100%!important;height:auto}*/a{color:#F90}a:hover,a:active,a:focus{color:#F90}#ja-containerwrap{padding:0;padding-bottom:60px}</style></head><body id="bd" class="fs4"><div id="main-container"><br><br><br><br><br><div id="ja-containerwrap"> <div id="ja-container" class="clearfix"><div style="padding: 20px 30px 20px 30px;"><div class="ja-innerpad clearfix"><div class="componentheading">Your submission was successful. Thank you.</div><p align="right">This form was processed by <a href="http://forms-expert.com">Forms Expert</a>.<p align="right">© 2009 Forms-Expert. </div></div></div></div><div id="ja-footerwrap"><div id="ja-footer" class="clearfix"><ul><li><a href="http://forms-expert.com">Visit Forms Expert</a></li><li><a href="http://forms-expert.com/form-processing-features/">Features</a></li><li><a href="http://forms-expert.com/download/">Download Beta</a></li><li><a href="http://forms-expert.com/support/">Support</a></li><li><a href="http://forms-expert.com/contactus/">Contact page</a></li></ul><small class="ja-copyright">© 2009 <a href="http://forms-expert.com/">Forms-Expert</a></small></div></div></div></body></html> <?php } function display_spam_warning() { ?> <html> <form action="" method="post"><style> .form_expert_style {display: none;} </style> <?php IsThereErrors("1", $_iserrors); ?> <input type="hidden" name="firstname" value="<?php echo htmlspecialchars($_values['firstname'])?>"> <input type="hidden" name="lastname" value="<?php echo htmlspecialchars($_values['lastname'])?>"> <input type="hidden" name="email" value="<?php echo htmlspecialchars($_values['email'])?>"> <input type="hidden" name="companynumber" value="<?php echo htmlspecialchars($_values['companynumber'])?>"> <input type="hidden" name="upload1" value="<?php echo htmlspecialchars($_values['upload1'])?>"> <input type="hidden" name="upload1_real-name" value="<?php echo htmlspecialchars($_values['upload1_real-name'])?>"> <input type="hidden" name="upload2" value="<?php echo htmlspecialchars($_values['upload2'])?>"> <input type="hidden" name="upload2_real-name" value="<?php echo htmlspecialchars($_values['upload2_real-name'])?>"> <input type="hidden" name="upload3" value="<?php echo htmlspecialchars($_values['upload3'])?>"> <input type="hidden" name="upload3_real-name" value="<?php echo htmlspecialchars($_values['upload3_real-name'])?>"> <input type="hidden" name="upload4" value="<?php echo htmlspecialchars($_values['upload4'])?>"> <input type="hidden" name="upload4_real-name" value="<?php echo htmlspecialchars($_values['upload4_real-name'])?>"> <input type="hidden" name="upload5" value="<?php echo htmlspecialchars($_values['upload5'])?>"> <input type="hidden" name="upload5_real-name" value="<?php echo htmlspecialchars($_values['upload5_real-name'])?>"> <input type="hidden" name="_referer" value="<?php echo $_referer ?>"> <input type="hidden" name="_next_page" value="2"> <p class="form_expert_style"><input name="URL" type="text" value=""/></p> <p align="center"><b>Your submission seems to be a SPAM. Please contact web site administrator or click "Back" button to return to the form.</b></p> <p align="center"><input type="submit" name="back" value="< Back"></p></form> </html> <?php } function BuildBody($body, $html, $num){ global $zag, $un; if ($html) { $zag[$num] = "--".$un."\r\nContent-Type:text/html;\r\n"; } else { $zag[$num] = "--".$un."\r\nContent-Type:text/plain;\r\n"; }; $zag[$num] .= "Content-Transfer-Encoding: 8bit\r\n\r\n$body\r\n\r\n"; } function SendEmails (){ global $_values, $zag, $un; $un = strtoupper(uniqid(time())); $to[0] .= htmlspecialchars($_values["companynumber"]) . "@aissolutions.ca"; $from[0] .= "".str_replace("%,%", ",", $_values['email']).""; $subject[0] .= "upload_form was submitted on ".date("F j, Y")." ".date("H:i").""; $head[0] .= "MIME-Version: 1.0\r\n"; $head[0] .= "From: ".str_replace("%,%", ",", $_values['email'])."\r\n"; $head[0] .= "X-Mailer: Forms Expert at www.forms-expert.com\r\n"; $head[0] .= "Reply-To: ".str_replace("%,%", ",", $_values['email'])."\r\n"; $head[0] .= "Content-Type:multipart/mixed;"; $head[0] .= "boundary=\"".$un."\"\r\n\r\n"; $EmailBody = "<html><body> Form was filled with the following data: <br><b>firstname:</b> ".htmlspecialchars($_values["firstname"])." <br><b>lastname:</b> ".htmlspecialchars($_values["lastname"])." <br><b>email:</b> ".htmlspecialchars($_values["email"])." <br><b>companynumber:</b> ".htmlspecialchars($_values["companynumber"])." <br><b>upload1:</b> ".htmlspecialchars($_values["upload1"])." <br><b>upload2:</b> ".htmlspecialchars($_values["upload2"])." <br><b>upload3:</b> ".htmlspecialchars($_values["upload3"])." <br><b>upload4:</b> ".htmlspecialchars($_values["upload4"])." <br><b>upload5:</b> ".htmlspecialchars($_values["upload5"])." </body></html> "; BuildBody($EmailBody, True, 0); for ($i=0;$i<=0;$i++){ mail($to[$i], $subject[$i], $zag[$i], $head[$i]); } } $actions = array ("display_page_upload_form","display_thankyou"); session_start(); if(!isset($_SESSION["FormSent"])) { $_SESSION["FormSent"] = time(); $delta = -1; } else { $delta = time() - $_SESSION["FormSent"]; } if (((strlen(trim(@$_POST["URL"])) > 0) or (($delta>-1)and($delta<2)))and(!isset($_POST["back"]))){ display_spam_warning(); }else{ unset($_SESSION["FormSent"]); if (in_array($_GET["image"], array("warning"))) { header("Content-type: image/png"); echo base64_decode("iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanZZ3VFTXFofPvXd6oc0w0hl6ky4wgPQuIB0EURhmBhjKAMMMTWyIqEBEEREBRZCggAGjoUisiGIhKKhgD0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y5y8/w9g07JM6hoYOuF9RG+f7uM8O/91cZ9CwUtJiY2LLBrVsgAAggpj+//5krakkGC3C8Y/j89AUDMOGDDYHFI9gAoK9+QQ3+ASzsBPkFGPQMVRl+/PjLoK4lx8DNyQVOFyD5X1D1YH2w9ANiA8399OABg4TwFwYlbenSP7//W4McABBALEyMHI7SMqzs3x7cYfgNLGeYQHEPTCZMQFczsgIxKMmwQOohBiCbERhmzKzvGDycdBkcXOIYOP+cY/j36T3Db6C+/6BcBso5/yBR9f8vJGr+Qdl/f/1j+HrvNoOquhrbk9vcqUBVRwECiIWZjV36x6PXDN/+fmX4D7QAhJnYIJYxMUEiiRFU2AEx039YjvnHwPRxPwMX435gOQG1ENpnAKljAOL/oMgF8YHmgNT8h2bPL08+MrAAKywuPhYzkBaAAGL59vnVqSf3GBgUBYFFOjcjAzMnE7CEA1oGrAaYWBnBIQDyNZhmRDgI0q2BOIqJAWIZsPQB0/+hoQELgb8//0NyE9Alv7//Y7h/7gnD67cMm0FGAAQQi0VQ2frbpzZOPn37Rryk6H8+7l8sDGzfmBmYQaHAxAi2HGQRjIZ3qRiRa0/UnhM4KmA0KE39/sfw6/t/hl8f/zA8fwrMrFKqS0z9/dtAygECiBFUBnx4cZvh8/tnGoyMzLJAO7mAQc8G8TuSlaT0YRlRa3dgsfwXaM0vYFQB8Z8XvIJSVwQl1UBlKgNAADHiaTwyYRhFHviPhDEAQACx4HA7I5UsZ8BiDopDAAIMAP+QrU5p/QTlAAAAAElFTkSuQmCC"); }else{ if (isset($_POST["_next_page"])) { $_next_page = $_POST["_next_page"]; }else $_next_page = 0; if (isset($_POST["back"])) { call_user_func($actions[$_next_page-2],false); }else if (IsThereErrors($_next_page-1, false)){ call_user_func($actions[$_next_page-1],true); }else { call_user_func($actions[$_next_page+0],false); if ($_next_page == count($actions)-1) { SendEmails(); session_destroy(); } } } } ?> In brief, I'm attempting to capture the form data from a dynamic form to a mysql database. From he
To He
The post data looks like this from the form - Array(
... ) PHP CODE:
... As a non-php or mysql developer, I'm learning on the fly. This is a section of the php file that I was using to post the form data to mySQL. This worked great up to the point I added the dynamic form widget. <?php // This function will run within each post array including multi-dimensional arrays function ExtendedAddslash(&$params) { foreach ($params as &$var) { // check if $var is an array. If yes, it will start another ExtendedAddslash() function to loop to each key inside. is_array($var) ? ExtendedAddslash($var) : $var=addslashes($var); unset($var); } } // Initialize ExtendedAddslash() function for every $_POST variable ExtendedAddslash($_POST); $submission_id = $_POST['submission_id']; $formID =$_POST['formID']; $ip =$_POST['ip']; $fname =$_POST['fname']; $lname =$_POST['lname']; $spousename =$_POST['spousename']; $address =$_POST['address'][0]." ".$_POST['address'][1]." ".$_POST['address'][2]." ".$_POST['address'][3]." ".$_POST['address'][4]." ".$_POST['address'][5]; ... $db_host = 'localhost'; $db_username = 'xxxxx'; $db_password = 'xxxxx'; $db_name = 'xxxxx'; mysql_connect( $db_host, $db_username, $db_password) or die(mysql_error()); mysql_select_db($db_name); // search submission ID $query = "SELECT * FROM `tableName` WHERE `submission_id` = '$submission_id'"; $sqlsearch = mysql_query($query); $resultcount = mysql_numrows($sqlsearch); if ($resultcount > 0) { mysql_query("UPDATE `tableName` SET `fname` = '$fname', `lname` = '$lname', `spousename` = '$spousename', `address` = '$address', WHERE `submission_id` = '$submission_id'") or die(mysql_error()); } else { mysql_query("INSERT INTO `tableName` (submission_id, formID, IP, fname, lname, spousename, address) VALUES ('$submission_id', '$formID', '$ip', '$fname', '$lname', '$spousename', '$address') ") or die(mysql_error()); } ?> It has been suggested that I explore using the PHP Explode() function. It's possible that may work, but can't get my head around how to apply the function to the PETLIST Array. Looking for suggestions or direction to find a solution for this challenge. Looking forward to any replies. Hi All I am trying to upload a csv file to a database using php html form however, the results shows none of the data passsing through to the database and it produces 1000's of empty fields here is the form Code: [Select] form action="lib/import.php" method="post" enctype="multipart/form-data"> Type file name to import: <input type="file" name="filename" size="20"><br /> <input type="submit" name="submit" value="submit"></form> and here is the passing info Code: [Select] $file = $_FILES['filename']; $sqlstatement="LOAD DATA INFILE '$file' into TABLE shop FIELDS TERMINATED BY ',' (id, merchant_name, product_name, description, category_name, Affiliate_deep_link, Affiliate_image_url, price)" ; mysql_query($sqlstatement); echo "it is done!"; can anyone help please? so what i have going on is that i need help writing a basic script to upload original and copy with resize for thumbnail. then also need to rename both image files with content in the form. My server supports GD Library and that imagemagik or whatever it is lol. upload dirs orig: ../media/photos/ thumb: ../media/photos/thumb/ mySQL DB: name: m_photos fields: id(INT) m_cat(varchar) m_sub_cat(varchar) pic(varchar) description(varchar) p_group(varchar) I have the form written up for how it should look like: Code: [Select] <form action="upload.php" method="post" enctype="multipart/form-data"> Upload an image for processing<br /> <input type="file" name="Image"><br /> <select name="sub_group"> <option value="Photo Shoot">Photo Shoot</option> <option value="Live Performances">Live Performances</option> <option value="Randoms">Randoms</option> <option value="Fan Photos">Fan Photos</option> </select><br /> Location: <input type="text" name="p_group" /><br /> Date of Pic: <input type="text" name="date" /><br /> Description: <input type="text" name="description" /><br /> <input type="submit" value="Upload"> </form> so what needs to happen is for the file upload name. it needs to grab a count from "p_group" database to give it a starting number in a "00" pattern and then the date of pic needs to go in there next then the p_group name. so when the files gets uploaded it would look something like this after upload. "03 - Oct 21, 2011 - The Mex.jpg" NOTE: all pics must be converted to ".jpg" extension. both the orig and thumb will use that same file name cuz they just go into different dirs re-sizing for the thumbnail should be done by aspect ratio and needs to either be 300px width or 400px height. so if anyone would like to help me out please do. im not the greatest at writing in php yet Hey--New to the forum, and php. I have a drop-down list populated by a MySQL database. Submitting that selection retrieves php scripts which I run using eval(). One of them is a form. The scripts evaluate fine, but when I submit the second form, it disappears and I get a resource id where the "result" script was. The resource ids change between 3 and 4 when I refresh the page. Any hints on what I'm doing wrong? Here is the main script: <?php $host="localhost"; $username="root"; $password="root"; $con = mysql_connect($host,$username,$password); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("calculators", $con); $result = mysql_query("SELECT * FROM calculator"); while($row = mysql_fetch_array($result)) { echo "<option type='text' " . "value='" . $row['Title'] . "'>" . $row['Title'] . "</option>"; } echo "</select>"; echo "<br>"; echo "<input type='submit' name='submit1'>"; echo "</form>"; $title = mysql_real_escape_string($_GET['Title']); $result = mysql_query('SELECT * FROM calculator WHERE Title = "' . $title . '"'); while($row = mysql_fetch_array($result)) { $header = $row['Header']; $calculator = $row['Calculator']; $result = $row['Result']; $formula = $row['Formula']; $reference = $row['Reference']; } eval('?>' . $header . '<?php '); echo "<h2>Calculator</h2>"; eval('?>' . $calculator . '<?php '); echo "<h2>Result</h2>"; eval('?>' . $result . '<?php '); echo "<h2>Formula</h2>"; eval('?>' . $formula . '<?php '); echo "<h2>Reference</h2>"; eval('?>' . $reference . '<?php '); mysql_close($con); ?> Thanks, Davis I can not get the values from the javascript add row to go dynamically as a row into MySql only the form values show up as the form below as one row. I made it as an array, but no such luck, I have tried this code around a multitude of ways. I don't know what I am doing wrong, kindly write out the correct way.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...ransitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Dynamic Fields js/php to MySql need to submit dynamically to the database</title> <?php require ('database.php'); ?> <script type="text/javascript"> var counter = 1; var collector = ""; function addfields(indx) { var tbl = document.getElementById('table_id'); var newtr = document.createElement('tr'); counter = counter + indx; newtr.setAttribute('id','tr'+counter); newtr.innerHTML = '<td><input type="checkbox" name="checkb'+counter+'" id="checkb'+counter+'" value="'+counter+'" onclick="checkme('+counter+')"></td><td><input type="text" name="text1[]"></td><td><textarea name="textarea1[]"></textarea></td>'; tbl.appendChild(newtr); } function checkme(dx) { collector += dx+","; } function deletetherow(indx) { var col = collector.split(","); for (var i = 0; i < col.length; i++) { var remvelem = document.getElementById('tr'+col[i]); var chckbx = document.getElementById("checkb"+col[i]); if(remvelem && chckbx.checked) { var tbl = document.getElementById('table_id'); tbl.removeChild(remvelem); } } } </script> </head> <body> <form enctype="multipart/form-data" id="1" style="background-color:#ffffff;" action="<?php echo $_SERVER['PHP_SELF']; ?>"></form> <table id="table_id" > <tr id="tr1" class="trmain"> <td> </td> <td> <input type="text" name="text1[]"> </td> <td> <textarea name="textarea1[]"></textarea> </td> </tr> </table> <input type="button" value="Add" onClick="addfields(1);" /> <input type="button" value="Delete" onClick="deletetherow()" /> <input type="submit" value="Send" id="submit" name="submit"/> <?php if(isset($_POST['submit'])) { for ($i=0; $i < count($_POST['text1']); $i++ ) { $ced = stripslashes($_POST['text1'][$i]); $erg = stripslashes($_POST['textarea1'][$i]); } $bnt = mysql_query("INSERT INTO tablename (first, second) VALUES ('$ced', '$erg')")or die('Error: '. mysql_error() ); $result = mysql_query($bnt); } ?> </body> </html> Hello, first time poster.. I've looked the web over for a long time and can't figure this one out. - Below is basic code that successfully checks MySQL for a match and displays result. I was debugging and forced the "height" and "width" to be 24 and 36 to make sure that wasn't the problem. That's good.. - I'd like to give the user ability to select width and height from a form.. and have it do an onchange this.form.submit so the form can be changing as fields are altered (thus the onchange interaction) - In a normal coding environment I've done this numerous times with no "Page cannot be displayed" problems. It would simply change one select-option value at a time til they get down the form and click submit... but in WordPress I'm having trouble making even ONE single onchange work! - I've implemented the plugins they offer which allows you to "copy+paste" your php code directly into their wysiwyg editor. That works with basic tests like my first bullet point above. - I've copied and pasted the wordpress url (including the little ?page_id=123) into the form "action" url... that didn't work... tried forcing it into an <option value=""> tag.. didn't work. I'm just not sure. I've obviously put xx's in place of private info.. Why does this form give me Page Cannot Be Displayed in WordPress every time? It won't do anything no matter how simple.. using onchange.. Code.. $con = mysql_connect("xxxx.xxxxxxx.com","xxxxxx","xxxxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("xxxxxx", $con); $myprodwidth=24; $myprodheight=36; $result = mysql_query("SELECT * FROM product_sizes WHERE prodwidth='$myprodwidth' and prodheight='$myprodheight'"); while($row = mysql_fetch_array($result)) { echo $row['prodprice']; } mysql_close($con); <form method="post" action=""> <select name="myheight" onchange="this.form.submit();"> <option selected="selected" value="">select height</option> <option value="xxxxxxxxx.com/wordpress/?page_id=199&height=36">36</option> <option value="xxxxxxxxx.com/wordpress/?page_id=199&height=36">48</option> </select> Hi all, What I am trying to achieve is, I thought quite simple! Basically, a user signs up and chooses a package, form is submitted, details added to the database, email sent to customer, then I want to direct them to a paypal payment screen, this is where I am having issues! Is their any way in php to submit a form without user interaction? Here is my code for the form process page Code: [Select] <?php include('config.php'); require('scripts/class.phpmailer.php'); $package = $_POST['select1']; $name = $_POST['name']; $email = $_POST['email']; $password = md5($_POST['password']); $domain = $_POST['domain']; $a_username = $_POST['a_username']; $a_password = $_POST['a_password']; $query=mysql_query("INSERT INTO orders (package, name, email, password, domain, a_username, a_password) VALUES ('$package', '$name', '$email', '$password', '$domain', '$a_username', '$a_password')"); if (!$query) { echo "fail<br>"; echo mysql_error(); } else { $id = mysql_insert_id(); $query1=mysql_query("INSERT INTO customers (id, name, email, password) values ('$id', '$name', '$email', '$password')"); if (!$query1) { echo "fail<br>"; echo mysql_error(); } if($package=="Reseller Hosting") { //email stuff here - all works - just cutting it to keep the code short if(!$mail->Send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; } ?> <form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick-subscriptions"> <input type="hidden" name="business" value="subscription@jollyhosting.com"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="item_name" value="Jolly Hosting Reseller Packages"> <input type="hidden" name="no_shipping" value="1"> <!--1st month --> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="a3" value="3.00"> <input type="hidden" name="p3" value="1"> <input type="hidden" name="t3" value="M"> <input type="hidden" name="src" value="1"> <input type="hidden" name="sra" value="1"> </form>'; <?php } //last } //end ?> Say I have an "Entries" table. I want to submit same multiple entries using a form submission. And If I have other queries submitted in the same form, I want those quarries to be submitted only once. Is that possible to do? Here's my code. if(isset($_POST['submit'])) { $entries = 10; $id = 55; $name = 'Smith'; $insert = $db->prepare("INSERT INTO entries(id, name) VALUES(:id, :name)"); $insert->bindParam(':id', $id); $insert->bindParam(':name', $name); $result_insert = $insert->execute(); if($result_insert == false) { echo 'Fail'; } else { echo 'Success'; } } ?> <form action="" method="post"> <input type="submit" name="submit" value="SUBMIT" /> </form> Edited January 13, 2019 by imgrooot Hi. Pretty straight forward I guess but as the name suggests am a newbie. I have a form that requires the user to enter certain parameters. If the values are blank it submits to itself and loads the error messages. What I want to do is create PHP code that submits the form to a different url. What I thought was create two forms (the second with hidden fields replicating the first form), each form having a different url in the action"" code. What I cant work out is the PHP IF ELSE code to submit form 2 if Form1 is is validated correctly. This is the PHP code relevant to the form validation. Help? <?php //If form was submitted if ($_POST['submitted']==1) { $errormsg = ""; //Initialize errors if ($_POST[width]){ $title = $_POST[width]; //If title was entered } else{ $errormsg = "Please enter width"; } if ($_POST[drop]){ $textentry = $_POST[drop]; //If comment was entered } else{ if ($errormsg){ //If there is already an error, add next error $errormsg = $errormsg . " & content"; }else{ $errormsg = "Please enter drop"; } } } if ($errormsg){ //If any errors display them echo "<div class=\"box red\">$errormsg</div>"; } //If all fields present if ($title && $textentry){ //Do something echo 'THIS IS WHERE I WANT THE CODE TO SUBMIT FORM 2 or SUBMIT FORM 1 TO A DIFFERENT URL'; } ?> There are two pieces to this- The HTML Form and the resulting php. I can't seem to make the leap, from the code to having the form produce the php page so others can view it until the form is again submitted overwriting the php, thus generating new content. The environment I am working in is limited to IIs 5.1 and php 5.2.17 without mySQL or other DB I'm new to php, this isn't homework,or commercialization, it's for children. I am thinking perhaps fwrite / fread but can't get my head around it. Code snipets below. Any help, please use portions of this code in hopes I can understand it Thanks Code snipet from Output.php Code: [Select] <?php $t1image = $_POST["t1image"]; $t1title = $_POST["t1title"]; $t1info = $_POST["t1info"]; $t2image = $_POST["t2image"]; $t2title = $_POST["t2title"]; $t2info = $_POST["t2info"]; ?> ... <tbody> <tr><!--Headers--> <td style="vertical-align: top; text-align: center; background-color: rgb(204, 255, 255);">Animal</td> <td style="vertical-align: top; text-align: center; background-color: rgb(204, 255, 255);">Image thumb<br> </td> <td style="vertical-align: top; text-align: center; background-color: rgb(204, 255, 255);">Date<br> </td> <td style="vertical-align: top; text-align: center; background-color: rgb(204, 255, 255);">Information<br> </td> </tr> <tr> <td style="vertical-align: top; text-align: center;">Monkey </td> <td style="vertical-align: top; text-align: center;"><img src="<?php echo $t1image.'.gif'; ?>"><!--single image presented selected from radio buttons--> </td> <td style="vertical-align: top; text-align: center;"><?php echo date("m/d/Yh:i A"); ?><!--time stamp generated when submitted form populates all fields at once--> </td> <td style="vertical-align: top; text-align: center;"><a href="#monkey" rel="facebox"><?php echo $t1title ?></a><!--Link name provided by "Title 1", that links to hidden Div generated page with content from "Info1" field--> <div id="Monkey" style="display:none"> <?php echo $t1info; ?> </div> </td> </tr> <tr> <td style="vertical-align: top; text-align: center;">Cat<br> </td> <td style="vertical-align: top; text-align: center;"><img src="<?php echo $t2image.'.gif'?>"></td> <td style="vertical-align: top; text-align: center;"><?php echo date("m/d/Yh:i A"); ?></td> <td style="vertical-align: top; text-align: center;"><a href="#Cat" rel="facebox"><?php echo $t2title ?></a> <div id="Cat" style="display:none"> <?php echo $t2info; ?> </div> </td> </tr> <tr> This replicates several times down the page around 15-20 times ( t1### - t20###) Code Snipet from HTML Form Code: [Select] <form action="animals.php" method="post"> <div style="text-align: left;"><big style="font-family: Garamond; font-weight: bold; color: rgb(51, 51, 255);"><big><big><span>Monkey</span></big></big></big><br> <table style="text-align: left; width: 110px;" border="0" cellpadding="2" cellspacing="0"> <tbody><tr> <td style="vertical-align: top;">Image thumb<br> <input type="radio" name="t1image" value="No opinion" checked><img src="eh.gif" alt="Eh"> <input type="radio" name="t1image" value="Ok"><img src="ok.gif" alt="ok"> <input type="radio" name="t1image" value="Like"><img src="like.gif" alt="Like"> <input type="radio" name="t1image" value="Dont"><img src="dont.gif" alt="Don't Like"> <input type="radio" name="t1image" value="Hate"><img src="hate.gif" alt="Hate"> <input type="radio" name="t1image" value="Other"><img src="other.gif" alt="Other"> <br> Why Title:<input type="text" name="t1title" size="45" value="..."/></td> <td style="vertical-align: top;"> Explain:<br> <textarea name="t1info" cols=45 rows=3 value="..."></textarea> </td></tr></table> <br> <!--Next--> How do I get the Form data to save to the php page for others to view? Hi everyone, I have a page that i use to upload images to my website, i got a bit fed up of uploading one at a time so i decided to add multiple file fields to the form to upload multiple images at the same time. Im having a few problems, iv read up he http://www.php.net/manual/en/features.file-upload.multiple.php and it seems all i have to do is add [] to the form names to turn them into arrays. However when i come to upload the images, i keep getting the "$error[] = "Incorrect format!...." error from the code below. I cant seem to figure out what the problem is. Could anybody please point me in the right direction? <?php session_start(); $id = $_SESSION['id']; $connect = mysql_connect("localhost","leemp5_admin","p7031521"); mysql_select_db("leemp5_database"); $query = mysql_query("SELECT * FROM users WHERE id='$id'"); $row = mysql_fetch_assoc($query); $username = $row['username']; $submit = $_POST['submit']; $type = $_FILES['image']['type']; $size = $_FILES['image']['size']; $max_size = "1000"; $width = "100"; $height = "100"; $error = array(); function make_thumb($image_name,$filename,$new_width,$new_height) { $ext=getExtension($image_name); if(!strcmp("jpg",$ext) || !strcmp("jpeg",$ext)) $source_image=imagecreatefromjpeg($image_name); if(!strcmp("png",$ext)) $source_image=imagecreatefrompng($image_name); if(!strcmp("gif",$ext)) $source_image=imagecreatefromgif($image_name); $old_x=imageSX($source_image); $old_y=imageSY($source_image); $ratio1=$old_x/$new_width; $ratio2=$old_y/$new_height; if($ratio1>$ratio2) { $thumb_width=$new_width; $thumb_height=$old_y/$ratio1; } else { $thumb_height=$new_height; $thumb_width=$old_x/$ratio2; } $destination_image=ImageCreateTrueColor($thumb_width,$thumb_height); imagecopyresampled($destination_image,$source_image,0,0,0,0,$thumb_width,$thumb_height,$old_x,$old_y); if(!strcmp("jpg",$ext) || !strcmp("jpeg",$ext)) { imagejpeg($destination_image,$filename); } if(!strcmp("png",$ext)) { imagepng($destination_image,$filename); } if(!strcmp("gif",$ext)) { imagegif($destination_image,$filename); } imagedestroy($destination_image); imagedestroy($source_image); } function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } if($submit) { $image=$_FILES['image']['name']; if ($image) { $filename = stripslashes($_FILES['image']['name']); $extension = getExtension($filename); $extension = strtolower($extension); if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) { $error[] = "Incorrect format! Please make sure your image is a .jpg, .jpeg, .png or .gif file."; } else { $size=getimagesize($_FILES['image']['tmp_name']); $sizekb=filesize($_FILES['image']['tmp_name']); if ($sizekb > $max_size*1024) { $error[] = "Your image is too big! The maximum upload size is 1MB."; } else { $image_name=time().'.'.$extension; $newname="uploads/" . $username . "/images/".$image_name; $copied = copy($_FILES['image']['tmp_name'], $newname); if (!$copied) { $error[] = "There was an error uploading your image. Please try again!"; } else { $thumb_name='uploads/' . $username . '/images/thumbs/thumb_'.$image_name; $thumb=make_thumb($newname,$thumb_name,$width,$height); } } } } else { $error[] = "Please select an image to upload!"; } if(empty($error)) { echo "Upload Successfully!<br />"; echo '<img src="'.$thumb_name.'">'; mysql_query("INSERT INTO images VALUES ('','$username','$image_name','','','','','uploads/$username/images/$image_name','uploads/$username/images/thumbs/thumb_$image_name','$type','$size')"); } else { echo implode($error); } } ?> <form method="post" enctype="multipart/form-data" action="upload_images.php"> <input type="file" name="image[]" /><br /> <input type="file" name="image[]" /><br /> <input type="file" name="image[]" /><br /> <input type="file" name="image[]" /><br /> <input type="file" name="image[]" /><br /> <input type="file" name="image[]" /><br /> <input type="submit" name="submit" value="Upload"> </form> Thanks Hi Guys i need help on a small matter. if you go to https://www.mywebchambers.co.uk/invoiceman/form.php when submitted all works ok. However if you delete rows 3, 4 and 5 and submit the page shows a value of 0.00 in the total column on rows 3, 4 and 5. How do i get this value removed so it is blank same as the rest ?
My form action is toolstation3.php code below
<!doctype html> <?php
{$orderno =($_POST["orderno"]);}
{$code3 =($_POST["code3"]);}
{$code4 =($_POST["code4"]);}
{$code5 =($_POST["code5"]);}
{$sum1 =($_POST["sum1"]);} {$nil =($_POST["nil"]);}
$net=$sum1+$sum2+$sum3+$sum4+$sum5;
$total=$net+$vat;
$sum1 = number_format($sum1, 2, '.', '');
if(empty($_POST['quantity3']) && empty($_POST['price3'])) {echo " $nil";}
echo "<br>   ____________________________________________________________________________________________________<br><br>"; echo "<H3>    Address                                                                                                                     Details "; echo "<br>   ___________________________________________________________          ____________________________________<br><br>";
echo "<tr>
echo "<tr> echo "<table cellpadding=3 border=0 style='float:left'>";
echo "<tr> echo "<table cellpadding=3 border=0 style='float:left'>";
echo "<tr> echo "<table cellpadding=3 border=0>";
echo "<tr> echo "<H3>    Items"; echo "<br>   __________________________________________<br><br>";
echo "<tr><th>Code</th><th>Name</th><th>Quantity</th><th>Price</th><th>Total</th><th>Vat Band</th></tr>"; echo "<tr><td>$code1</td><td>$name1</td><td>$quantity1</td><td>$price1</td><td>$sum1</td><td>$vatband1</td> "; echo "<tr><td>$code2</td><td>$name2</td><td>$quantity2</td><td>$price2</td><td>$sum2</td><td>$vatband2</td> "; echo "<tr><td>$code3</td><td>$name3</td><td>$quantity3</td><td>$price3</td><td>$sum3</td><td>$vatband3</td> "; echo "<tr><td>$code4</td><td>$name4</td><td>$quantity4</td><td>$price4</td><td>$sum4</td><td>$vatband4</td> "; echo "<tr><td>$code5</td><td>$name5</td><td>$quantity5</td><td>$price5</td><td>$sum5</td><td>$vatband5</td> ";
echo "<br>"; echo "<H3>    VAT Analysis"; echo "<br>   __________________________________________<br><br>"; echo "<table cellpadding=5 border=1>"; echo "<tr><th>Band</th><th>Rate</th><th>Net</th><th>VAT</th><th>Total</th></tr>"; echo "<tr><td>5</td><td>20%</td><td>$net</td><td>$vat</td><td>$total</td> ";
<div id="container">
I need help with a form .. My form needs to allow an additional drop down field for Groups. This form also needs to save the extra fields chosen into my MySQL DB. Here is my form.. Code: [Select] <form action='' method='post' class='assessment'> <h1>Create User</h1> <div class='label'>First Name</div> <div class='field'><input type='text' name='firstname' value='<?=$preUser->firstname?>' /></div> <div class='cb'></div> <div class='label'>Last Name</div> <div class='field'><input type='text' name='lastname' value='<?=$preUser->lastname?>' /></div> <div class='cb'></div> <div class='label'>Password</div> <div class='field'><input type='text' name='password' value='<?=$preUser->password?>' /></div> <div class='cb'></div> <div class='label'>Company</div> <div class='field'><input type='text' name='company' value='<?=$preUser->company?>' /></div> <div class='cb'></div> <div class='label'>Job Title</div> <div class='field'><input type='text' name='job' value='<?=$preUser->job?>' /></div> <div class='cb'></div> <div class='label'>Group Name</div> <div class='field'><select name='group'><?=$groupSelect?></select></div> <div class='cb'></div> <div class='label'>Address</div> <div class='field'><input type='text' name='street1' value='<?=$preUser->street1?>' /></div> <div class='cb'></div> <div class='label'>Address (optional)</div> <div class='field'><input type='text' name='street2' value='<?=$preUser->street2?>' /></div> <div class='cb'></div> <div class='label'>City</div> <div class='field'><input type='text' name='city' value='<?=$preUser->city?>' /></div> <div class='cb'></div> <div class='label'>State</div> <div class='field'><input type='text' name='state' value='<?=$preUser->state?>' /></div> <div class='cb'></div> <div class='label'>Postal Code</div> <div class='field'><input type='text' name='postal' value='<?=$preUser->postal?>' /></div> <div class='cb'></div> <div class='label'>Country</div> <div class='field'><input type='text' name='country' value='<?=$preUser->country?>' /></div> <div class='cb'></div> <div class='label'>Fax</div> <div class='field'><input type='text' name='fax' value='<?=$preUser->fax?>' /></div> <div class='cb'></div> <div class='label'>Phone</div> <div class='field'><input type='text' name='phone1' value='<?=$preUser->phone1?>' /></div> <div class='cb'></div> <div class='label'>Phone 2</div> <div class='field'><input type='text' name='phone2' value='<?=$preUser->phone2?>' /></div> <div class='cb'></div> <div class='label'>Email</div> <div class='field'><input type='text' name='email' value='<?=$preUser->email?>' /></div> <div class='cb'></div> <div class='label'>Website</div> <div class='field'><input type='text' name='website' value='<?=$preUser->website?>' /></div> <div class='cb'></div> <div class='label'>Photo</div> <div class='field imgupload'> <input type='hidden' name='photo' /> <? if( $preUser->photo ){ ?> <img src="../<?=$preUser->photo?>" style="height:300px; float:left;" /> <span class="rmimage" style="color:red; cursor:pointer; font-size:20px;padding-left:15px;" alt="<?=$preUser->photo?>">x</span> <? }else{ ?> <iframe src="../view/photo_upload.php" frameborder="0" scrolling="no" width="300" height="30"></iframe> <? } ?> </div> <div class='cb'></div> <div class='label'>Payment Option</div> <div class='field'> <input type='radio' name='payment' value='Pay' <? if( $preUser->payment == 'Pay' ) echo "checked='checked'"; ?> />Pay<br /> <input type='radio' name='payment' value='NonPaid' <? if( $preUser->payment == 'NonPaid' ) echo "checked='checked'"; ?> />NonPaid </div> <div class='cb'></div> <div class='label'>Dashboard Options</div> <div class='field'> <div><input type='checkbox' name='mysteps' <? if( $preUser->mysteps ) echo "checked='checked'"; ?> value='1' />My Steps</div> <div><input type='checkbox' name='mycalendar' <? if( $preUser->mycalendar ) echo "checked='checked'"; ?> value='1' />My Calendar</div> <div><input type='checkbox' name='myprofiles' <? if( $preUser->myprofiles ) echo "checked='checked'"; ?> value='1' />My Profile</div> <div><input type='checkbox' name='myplans' <? if( $preUser->myplans ) echo "checked='checked'"; ?> value='1' />My Plans</div> </div> <div class='cb'></div> <div class='submit_assessment'><input type='submit' name='create_user' class='submit' value='Create User' /> <input type='button' value='Back' class='back' name='admin_create' /></div> <div class='cb'></div> </form> <script> function setUploadedImage(flink){ $('.imgupload > input:first').after('<img src="../'+flink+'" style="height:300px; float:left;" /><span class="rmimage" style="color:red; cursor:pointer; font-size:20px;padding-left:15px;" alt="'+flink+'">x</span>'); $('.imgupload > iframe:first').remove(); $('.imgupload > input:first').val(flink); } $('.rmimage').live('click', function (){ $(this).prev().prev().val(''); $(this).prev().remove(); $(this).after('<iframe src="../view/photo_upload.php" frameborder="0" scrolling="no" width="300" height="30"></iframe>'); $.post('../ajax/admin.php',{remove_image:$(this).attr("alt")}); $(this).remove(); }); </script> the specific area in question is this... Code: [Select] <div class='label'>Group Name</div> <div class='field'><select name='group'><?=$groupSelect?></select></div> I need to be able to add another dropdown list to allow for multiple group selections that get saved into the DB once submitted. How do I go about doing this?????? I have got another of those problems that should be easy to solve but I cannot get my head round it! I have a form to enter data into a table and one of the fields can be left blank. However, I'd data is entered in the field it can be a Zero. This is leaving me a problem as I cannot find a way to get the script to insert NULL if the field is blank but actually put the Zero in if that is what is entered. I have tried several permutations of nested if's using empty or isset, but whatever I try, the same result is inserted in both scenarios. The arguments I need to pass are...... If field is empty INSERT null If field is 0 INSERT 0 If field is not empty and not 0 INSERT field Thanks in advance for any suggestions. Steve Is there anything wrong (or insecure) with using hidden form fields? I am working on a page where the user can choose one of 4 different subscription options. The approach I was going to use is to have a separate form for each plan, and when the user chooses one, submit a hidden form value so my script knows which subscription plan to grab out of the database. Thoughts? Hello. So I already know an extremely elementary way to check to see if a form field is blank using PHP. For example: Code: [Select] if ($subject == "") The question I have is, is there a way to have php check every field in a form to make sure it has some sort of value? I want to create an 'if' statement which basically says, "If all form fields have something filled in, then do this" For example Code: [Select] if ($subject == "any value") & ($name == "any value") & ($comment == "any value") Not sure if that makes sense. Any help would be greatly appreciated!!! Hello
I'm using a small script (that I found online) to dynamically add fields to an order form.
It works well with normal text fields but I would like to use it with a select box fields (as it draws data from MySQL).
My problem is, that when the field is 'cloned' it contains the product id and not the product name - which is what the user needs to see.
<?php echo '<form method="post" name="orderform">'; // lots of form fields... echo '<div id="itemRows">'; echo 'Item quantity: <input type="text" name="add_qty" size="4" />'; $prod = "SELECT prod_id, product FROM products ORDER BY product ASC"; $prodRes = $mysqli->query($prod); echo 'Item name : <select name="add_name">'; while ($p = $prodRes->fetch_assoc()) { echo'<option value="'.$p['prod_id'].'">'.$p['product'].'</option>'; } echo '</select>'; echo '<input onclick="addRow(this.form);" type="button" value="Add row" /> (Won't be saved until you click on "Add row")'; if(isset($product['qty']) && isset($product['name'])) { ?> <p id="oldRow<?=$product['id']?>"> Item quantity: <input type="text" name="qty<?=$product['id']?>" size="4" value="<?=$product['qty']?>" /> Item name: <input type="text" name="name<?=$product['id']?>" value="<?=$product['add_name']?>" /> <input type="checkbox" name="delete_ids[]" value="<?=$product['id']?>"> Mark to delete </p> </div> <?php } ?> </div> <input type="submit" value="Submit new order" name="addOrder"> </fieldset> </div> </form> <script type="text/javascript"> var rowNum = 0; function addRow(frm) { rowNum ++; var row = '<p id="rowNum'+rowNum+'">Item quantity: <input type="text" name="qty[]" size="4" value="'+frm.add_qty.value+'"> Item name: <input type="text" name="name[]" value="'+frm.add_name.value+'"> <input type="button" value="Remove" onclick="removeRow('+rowNum+');"></p>'; jQuery('#itemRows').append(row); frm.add_qty.value = ''; frm.add_name.value = ''; } function removeRow(rnum) { jQuery('#rowNum'+rnum).remove(); } </script>I know I could use the $p['product'] value in the select box field, but when it is submiitted - it loses its $p['prod_id'] value which I need to input back into the MySQL database. I did try echo'<option value="'.$p['prod_id'].':'.$p['product'].'">'.$p['product'].'</option>';and then explode... foreach($_POST['name'] as $key => $value) { $items[] = current(explode(":", $value)); }...but clearly, that is a dreradful solution and looks awful to the user. Any thoughts, please? Thank you. Edited by tHud, 14 July 2014 - 09:31 AM. Hi I've got a form that users enter an identification pin in for their first question as well as clicking a radio button(Q1.php) . They click submit and the answers are put through a couple of multiplication function and then placed in a table (alongside the pin) via Q2.php. On the Q2 page I want to place the 2nd question that the user needs to answer. Rather than making them retype the pin I was hoping to process it as a hidden field - being picked up from their Q1.php entry. This 'hidden pin echo ' process will continue throughout Q2- Q10 pages. However - I can't seem to include any php in the page after the Q1 form has been processed. Have I got my php tags messed up? <?php $con = mysql_connect("localhost","ca","d"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("candango", $con); $q1 =$_POST['q1']; $pin =$_POST['pin']; $ans1 = $q1 * 3; $ans2 = $q1 * 5; $ans3 = $q1 * 2; $enter_sql= "INSERT INTO aapcm2 (pin,ans1, ans2, ans3) VALUES ('$pin','$ans1','$ans2','$ans3')"; $enter_query =mysql_query($enter_sql) or die (mysql_error()); ?> <body> <p>Thank you - You have successfully entered your answers.</p><form action="q2.php" method="post"> <p>What do you think the answer to this one is? <input type="radio" name="q2" id="q2" value="-3"> <label for="q2"></label> <input name="Hidden" type="hidden" id="Hidden" value="$pin" /></p> <p> <input type="submit" name="button" id="button" value="Submit"> </p> </form> <p></p> </body> |