PHP - Problem With Form
Hello everyone,
I'm creating a user information form which includes an image uploader as well as several text inputs. The problem is with... Code: [Select] <form ENCTYPE = "multipart/form-data"></form> When I have ENCTYPE set to multipart/form-data the image uploader works but not the text inputs. When its not set text inputs work but image uploader doesn't work. Anyone have insight into why this is and a good solution? Thanks Similar TutorialsHow can I get an output where it only shows the name of the drink and quantity where quantity > 0 ? Code: [Select] <?php if (!isset($_POST['submit'])) { // if page is not submitted to itself echo the form ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="nl"> <html> <form method="post" action="<?php echo $PHP_SELF;?>"> <?php $drinks = array("cola", "fanta", "bier", "koffie", "thee", "vodka"); $i = 0; echo "<table>"; while ($drinks[$i]) { $listnaam = $drinks[$i] . "_aantal"; $optionlist = "<select name= '$listnaam' ><option>0</option><option>1</option><option>2</option><option>3</option></select>"; echo "<tr><td >" . $drinks[$i] . "</td>"; echo "<td>" .$optionlist . "</td></tr>"; $i++; } echo "</table>"; ?> <input type="submit" value="Toon Output" name="submit"/> </form> <?php } else {echo $drinks;} ?> </html> When I press submit on the form, I do receive the email, but the text in the fields don't show up. How do I fix this? Thanks. FORM CODE: Code: [Select] <form method="post" id="contacts-form" action="process.php"> <fieldset> <div class="rowElem"> <input type="text" value="Name:" onFocus="if(this.value=='Name:'){this.value=''}" onBlur="if(this.value==''){this.value='Name:'}"> </div> <div class="rowElem"> <input type="email" value="E-mail:" onFocus="if(this.value=='E-mail:'){this.value=''}" onBlur="if(this.value==''){this.value='E-mail:'}"> </div> <textarea onFocus="if(this.value=='Message:'){this.value=''}" onBlur="if(this.value==''){this.value='Message:'}">Message:</textarea> <div class="alignright"><input value="Submit" type="submit" name="submit"></div> </fieldset> </form> PHP CODE: Code: [Select] <?php if(isset($_POST['submit'])) { $to = 'example@example.com' ; //put your email address on which you want to receive the information $subject = 'Contact Form'; //set the subject of email. $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $message = "<table><tr><td>Name</td><td>".$_POST['Name:']."</td></tr> <tr><td>E-Mail</td><td>".$_POST['E-mail:']."</td></tr> <tr><td>Message</td><td>".$_POST['Message:']."</td> </tr></table>" ; mail($to, $subject, $message, $headers); header('Location: contact.php'); } ?> Im a having a problem and im thinking maybe i cant do it with php and will have to look into java script I have several If statements but will only display two of them below. both inputs run on the same button $_POST['build'] the first if statement updates $naqahdah in the database. Its a number being subtracted. I need the 2nd if statement to grab the new updated naqahdah field in the database before the script reads it. Code: [Select] <?php if ($_POST['build']) { if ($_POST['homes']) { if ($naqahdah < $cost_homes) { }else{ mysql_query("UPDATE systems SET homes= $homes + '".mysql_real_escape_string($_POST['homes'])."' WHERE address = '".mysql_real_escape_string($_GET['planet'])."' AND id = '".($_SESSION['user_id'])."'"); mysql_query("UPDATE systems SET naqahdah= $naqahdah - $cost_homes WHERE address = '".mysql_real_escape_string($_GET['planet'])."' AND id = '".($_SESSION['user_id'])."'"); }}} if(isset($_POST['build'])) { if($_POST['naqahdah_mines']) { if ($naqahdah < $cost_naqahdah_mines) { }else{ mysql_query("UPDATE systems SET naqahdah_mines= $naqahdah_mines + '".mysql_real_escape_string($_POST['naqahdah_mines'])."' WHERE address = '".mysql_real_escape_string($_GET['planet'])."' AND id = '".($_SESSION['user_id'])."'"); mysql_query("UPDATE systems SET naqahdah= $naqahdah - $cost_naqahdah_mines WHERE address = '".mysql_real_escape_string($_GET['planet'])."' AND id = '".($_SESSION['user_id'])."'"); }}} ?> Hello, Having a problem when putting an xml tag in an input field. The field shows blank in $_POST. Heres some sample code
<!doctype html>
If I put <test in the field it shows up blank in the print of POST. I actually want to pass xml in a hidden field, and it wouldnt work. Tracked it down to this problem. Thanks in Advance Edited May 14, 2020 by derbyshiresoftwareerror Below here is the php and form i got right now. What i want to achieve is that when i check a checkbox that the TotalCosts will be updated by the matching value, and when i checked multiple boxes that those vallues will be added together. But the most important thing what i want to achieve right now is that when you check a box that the TotalCosts echo on the screen will be updated right away with the correct vallues. I tried some things i found while looking here and on other sites, but nothing seems to be working the way i want. Anyways, here is my php, i hope someone can help me <?php $hire = 60.00; $hire1 = 20.00; $hire2 = 22.50; $TotalCosts = 0.00; ?> <form action="index.php" method="post"> <input type="checkbox" name="hire" value="" />Hire <br /> <input type="checkbox" name="hire1" value="" />Hire1 <br /> <input type="checkbox" name="hire2" value="" />Hire2 <br /> </form> <?php if (isset($_POST['hire'])) { $TotalCosts = $TotalCosts + $hire; } if (isset($_POST['hire1'])) { $TotalCosts = $TotalCosts + $hire1; } if (isset($_POST['hire2'])) { $TotalCosts = $TotalCosts + $hire2; } echo $TotalCosts; ?> I don't know whether this is a PHP or an HTML question. I want to be able to post a preset value to accompany an input text value, and have both values entered in the database record. You can see in the code below that the form asks for names for up to six student groups, such as "Year7", "Year8", "Year9" and so on. What I want my form to do is to post the accompanying preset input name (in this case "group1", "group2", "group3", and so on) to a second column in the same record, so that I can search the records on this preset field. How can I do this? Code: [Select] <table width="750" align="center" cellpadding="4"> <form action="admin_login.php" method="post" enctype="multipart/form-data"> <tr> <td><div align="right"><font size="-1">Student Group 1: </font><font color="#CC0000"> </font></div></td> <td><input name="group1" type="text" value="<?php echo "$group1"; ?>" /></td> </tr> <tr> <td><div align="right"><font size="-1">Student Group 2: </font><font color="#CC0000"> </font></div></td> <td><input name="group2" type="text" value="<?php echo "$group2"; ?>" /></td> </tr> <tr> <td><div align="right"><font size="-1">Student Group 3: </font><font color="#CC0000"> </font></div></td> <td><input name="group3" type="text" value="<?php echo "$group3"; ?>" /></td> </tr> <tr> <td><div align="right"><font size="-1">Student Group 4: </font><font color="#CC0000"> </font></div></td> <td><input name="group4" type="text" value="<?php echo "$group4"; ?>" /></td> </tr> <tr> <td><div align="right"><font size="-1">Student Group 5: </font><font color="#CC0000"> </font></div></td> <td><input name="group5" type="text" value="<?php echo "$group5"; ?>" /></td> </tr> <tr> <td><div align="right"><font size="-1">Student Group 6: </font><font color="#CC0000"> </font></div></td> <td><input name="group6" type="text" value="<?php echo "$group6"; ?>" /></td> </tr> <tr> <td><div align="right"></div></td> <td><input type="submit" name="Submit" value="Submit Form" /></td> </tr> </form> Hi, ok so i have just created a form in HTML and am having the following problem in CSS
This is what the form looks like: http://gyazo.com/0aa...0dcf8f30efe4f9d
Now you can see that the width is covering the page each side
How can i fix this? for both width and height?
Here is my code:
#form { background-color: #111; margin: 0; text-align: center; padding: 15px; width: auto; height: auto; color: yellow; } #form input { border: 2px solid #ff0000; color: #ff0000; } For those willing to run this sample problem, reference the 2 files below. You will need to create an Excel file called blank.xls and put it in the same directory as these 2 files. When you launch indexTest.php, it will load the formTest.html.php page. This form has 3 options on it: 1. Export Excel - will prompt you to download the Excel file you made and should clear the error message on the form 2. Test Flag - tests the functionality of clearing the error message, shows what should happen when the Export Excel option is selected 3. Reset - resets back to initial state I really need the Export Excel option to be allow the form to reload properly. This is a problem that I have been wresting with for awhile and need a solution. Hopefully someone can give me some insight on how to get this to work. indexTest.php <?php $frmErrorLevel=1; $frmErrMsg='Error Level 1 indicated'; if(isset($_POST['action']) && $_POST['action']=='submitted') { if(isset($_POST['ExportCarrier'])) { $download_filename = "blank.xls"; $FileInfo = pathinfo($download_filename); // fix for IE catching or PHP bug issue header("Pragma: public"); header("Expires: 0"); // set expiration time header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); // browser must download file from server instead of cache // force download dialog header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-type: application/x-msexcel"); header("Content-Type: application/download"); // use the Content-Disposition header to supply a recommended filename and // force the browser to display the save dialog. header("Content-Disposition: attachment; filename=".$download_filename.";"); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($download_filename)); @readfile($download_filename); //ob_end_clean(); $frmErrorLevel=0; } if(isset($_POST['Test_Flag']) && $_POST['Test_Flag']=='Test Flag'){ $frmErrorLevel=0; $frmErrMsg=''; } } include ('formTest.html.php'); exit(); ?> formTest.html.php <?php ini_set ("display_errors", "1"); error_reporting(-1); echo "<pre>"; echo "--> Form data (POST) <-- <br>"; print_r ($_POST); echo "--> Form data (GET) <-- <br>"; print_r ($_GET); echo "</pre>"; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Export Trucking Data</title> </head> <body> <h1>Export Data</h1> <form action="" method="post"> <?php if($frmErrorLevel>0) { echo '<font color=#CC6600 size=+1>'.$frmErrMsg.'</font><br><br>'; } ?> <table width="650" border="0"> <caption> <font size="+3">Data Export Options</font> </caption> <tr> <td> <?php if($frmErrorLevel==1) print '<img src= "..\..\images\rdx.gif">'; else echo " "; ?> </td> <td width="275"><label> Carrier table data</label></td> <td width="100"><input name="ExportCarrier" type="submit" value="Export Excel"></td> <td> <div align="center"> <td><input type="submit" name="Test Flag" value="Test Flag"></td> <td> <div align="center"> <td><input type="submit" name="Reload Form" value="Reset"></td> </tr> </table> <div> <input type="hidden" name="action" value="submitted" /> </div> </form> </body> </html> Hi !
I am created this form - well it's more of a view and less of a form since the form part is only the check-boxes column and the rest is the data displayed from a database. But now I want to have this submitted with a SUBMIT button centered beneath the form after I have checked the required check boxes. I am unable to find a way to do this maybe simple task. Please help,
unclubbed.php
<?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = ''; $db = 'testdb'; // CHANGE THIS TO ANY EXISTING DB ON PHPMYADMIN OR CREATE THIS DB FIRST IN PHPMYADMIN // $fcon = mysqli_connect($dbhost, $dbuser, $dbpass, $db); if(!$fcon ) { die('Could not connect: ' . mysql_error()); } // echo 'Connected successfully'; /* /////////// UNCOMMENT TO CREATE A TABLE IN A DATABASE NAMED testdb THEN COMMENT BACK ///////////// $sql = "CREATE TABLE member( mid INT NOT NULL AUTO_INCREMENT, name VARCHAR(20) NOT NULL, reg_date Date NOT NULL, email VARCHAR(30) NOT NULL, cell INT NOT NULL, status VARCHAR(2) NOT NULL, primary key ( mid ))"; if (mysqli_query($fcon,$sql)) { echo "Table member created successfully"; } else { echo "Error creating table: " . mysqli_error($con); } $query = "Insert into member (name, reg_date, email, status) VALUES ('John','1980-08-12','john@123.com','9878954323','cc')"; mysqli_query($fcon, $query); $query = "Insert into member (name, reg_date, email, status) VALUES ('Bill','1988-03-21','bill@123.com','9878900123','cc')"; mysqli_query($fcon, $query); $query = "Insert into member (name, reg_date, email, status) VALUES ('Jack','1990-05-18','jack@123.com','9878912300','cc')"; mysqli_query($fcon, $query); */ $check = true; $query = "SELECT * from member"; $result = mysqli_query($fcon, $query); if(isset($_POST['submit']) && $_POST['submit'] == 'Submit') { echo "<br> Member = ".$_POST['name']."<br>" ; echo "RegDate = ".$_POST['reg_date']."<br>" ; echo "Email = ".$_POST['email']."<br>" ; echo "Status = ".$_POST['status']."<br>" ; /// more code would go here once I have submitted the check box information successfully ///// } ?> <html> <head> <title> CLUB ADMIN </title></head> <body> <table> <?php echo "<table class = 'TFtable' border = 1 cellspacing =2 cellpadding = 5 >"; echo "<tr>"; echo "<th> S.No. </th>"; echo "<th> Member </th>"; echo "<th> Reg Date </th>"; echo "<th> Email </th>"; if($check == true) echo "<th> <Input type='checkbox' id='selecctall' /> All </th>"; else echo "<th> Status </th>"; echo "</tr>"; $cnt = 1; while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { $name = htmlspecialchars($row['name']); $reg_date = htmlspecialchars($row['reg_date']); $cell = htmlspecialchars($row['cell']); $email = htmlspecialchars($row['email']); $mid = htmlspecialchars($row['mid']); if($check == false) $status = htmlspecialchars($row['status']); echo "<tr>"; echo "<td>".$cnt++."</td>"; echo "<td>".$name."</td>"; echo "<td>".$reg_date. "</td>"; echo "<td>".$email. "</td>"; if($check == true) { echo "<form name = 'form1' action='unclubbed.php' method='post' > "; echo "<td align ='center'><Input type='hidden' name='mid' value=$mid> <Input class='checkbox1' type = 'checkbox' name='check[]' value='$mid'> </td>"; echo "</form>"; echo "</tr>"; } else echo "<td>".$status. "</td> </tr> "; } ?> </table> </body> </html>Thanks ! I am building a hospital chart simulation for my pharmacy students and I am trying to learn PHP. Today is form validation. The following form has only one input. I have tried to piece together examples I find and from readings. The function works if the student leaves the input null, but does not catch any other errors and passes them to the next form as typed. The Patient ID is a 6 digit numeric between 100000 and 999999 and the 'patientid' will eventually be placed in a MySQL query to see if a patient with that number exists, but one question at a time. Thanks for any help. <?php session_start(); if (isset($_POST['submit'])) { $patient_id = check_input($_POST['patient_num'], "Enter Patient ID"); $_SESSION['patientid'] = $patient_id; header('Location: pt_found.php'); exit(); } ?> <!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>Patient Call Form</title> <link rel="stylesheet" type="text/css" href="main.css" /> </head> <body> <form name="patientfindform" action="#" method="post"> <div> <label>Patient ID:</label> <input type="text" name="patient_num" /><br /> </div> <div> <label> </label> <input type="submit" name="submit" value="Find Patient" /><br /> </div> </form> <script> type="text/javascript"> document.patientfindform.patient_num.focus(); </script> </div> </body> </html> <?php function check_input ($data, $problem='') { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); if ($problem && strlen($data)== 0) { die($problem); } return $data; } ?> Hi everyone, im working on a e comm site as a project. I have a register.php page, and its supposed to check for the presence of posted data, and if data is not posted show a form block,and if posted data is present insert it into a database. However its not working,i get an unexpected } on line 114, where there is a }else{ . I've only been working with php a few days, but from what i've read the braces seem where they should be,can someone please tell me where the problem is? <script language="JavaScript" type="text/javascript" src="library/checkout.js"></script> <?php //set up a couple of functions function doDB() { global $mysqli; //connect to server and select database; you may need it $mysqli = mysqli_connect("localhost", "root", "", "onlinestore"); } //determine if they need to see the form or not if (!$_POST) { //they need to see the form, so create form block $display_block = " <form name=\"register\" method=\"post\"action=\"index.php?r=1\"\ id=\"register\"> <table width=\"550\" border=\"0\" align=\"center\" cellpadding=\"5\" cellspacing=\"1\" class=\"entryTable\"> <tr class=\"entryTableHeader\"> <td colspan=\"2\">Login Details</td> </tr> <tr> <td width=\"150\" class=\"label\">Email</td> <td class=\"content\"><input name\=\"txtEmail\" type=\"text\" class=\"box\" id=\"txtEmail\" size=\"30\" maxlength=\"50\"></td> </tr> <tr> <td width=\"150\" class=\"label\">Password</td> <td class=\"content\"><input name=\"txtPassword\" type=\"password\" class=\"box\" id=\"txtPassword\" size=\"30\" maxlength=\"50\"></td> </tr> </table> <p> </p> <table width=\"550\" border=\"0\" align=\"center\" cellpadding=\"5\" cellspacing=\"1\" class=\"entryTable\"> <tr class=\"entryTableHeader\"> <td colspan=\"2\">Shipping Information</td> </tr> <tr> <td width=\"150\" class=\"label\">First Name</td> <td class=\"content\"><input name=\"txtShippingFirstName\" type=\"text\" class=\"box\" id=\"txtShippingFirstName\" size=\"30\" maxlength=\"50\"></td> </tr> <tr> <td width=\"150\" class=\"label\">Last Name</td> <td class=\"content\"><input name=\"txtShippingLastName\" type=\"text\" class=\"box\" id=\"txtShippingLastName\" size=\"30\" maxlength=\"50\"></td> </tr> <tr> <td width=\"150\" class=\"label\">Address1</td> <td class=\"content\"><input name=\"txtShippingAddress1\" type=\"text\" class=\"box\" id=\"txtShippingAddress1\" size=\"50\" maxlength=\"100\"></td> </tr> <tr> <td width=\"150\" class=\"label\">Address2</td> <td class=\"content\"><input name=\"txtShippingAddress2\" type=\"text\" class=\"box\" id=\"txtShippingAddress2\" size=\"50\" maxlength=\"100\"></td> </tr> <tr> <td width=\"150\" class=\"label\">Phone Number</td> <td class=\"content\"><input name=\"txtShippingPhone\" type=\"text\" class=\"box\" id=\"txtShippingPhone\" size=\"30\" maxlength=\"32\"></td> </tr> <tr> <td width=\"150\" class=\"label\">Area</td> <td class=\"content\"><input name=\"txtShippingState\" type=\"text\" class=\"box\" id=\"txtShippingState\" size=\"30\" maxlength=\"32\"></td> </tr> <tr> <td width=\"150\" class=\"label\">City</td> <td class=\"content\"><input name=\"txtShippingCity\" type=\"text\" class=\"box\" id=\"txtShippingCity\" size=\"30\" maxlength=\"32\"></td> </tr> <tr> <td width=\"150\" class=\"label\">Post Code</td> <td class=\"content\"><input name=\"txtShippingPostalCode\" type=\"text\" class=\"box\" id=\"txtShippingPostalCode\" size=\"10\" maxlength=\"10\"></td> </tr> </table> <p> </p> <table width=\"550\" border=\"0\" align=\"center\" cellpadding=\"5\" cellspacing=\"1\" class=\"entryTable\"> <tr class=\"entryTableHeader\"> <td width=\"150\">Payment Information</td> <td><input type=\"checkbox\" name=\"chkSame\" id=\"chkSame\" value=\"checkbox\" onClick=\"setPaymentInfo(this.checked);\"> <label for=\"chkSame\" style=\"cursor:pointer\">Same as shipping information</label></td> </tr> <tr> <td width=\"150\" class=\"label\">First Name</td> <td class=\"content\"><input name=\"txtPaymentFirstName\" type=\"text\" class=\"box\" id=\"txtPaymentFirstName\" size=\"30\" maxlength=\"50\"></td> </tr> <tr> <td width=\"150\" class=\"label\">Last Name</td> <td class=\"content\"><input name=\"txtPaymentLastName\" type=\"text\" class=\"box\" id=\"txtPaymentLastName\" size=\"30\" maxlength=\"50\"></td> </tr> <tr> <td width=\"150\" class=\"label\">Address1</td> <td class=\"content\"><input name=\"txtPaymentAddress1\" type=\"text\" class=\"box\" id=\"txtPaymentAddress1\" size=\"50\" maxlength=\"100\"></td> </tr> <tr> <td width=\"150\" class=\"label\">Address2</td> <td class=\"content\"><input name=\"txtPaymentAddress2\" type=\"text\" class=\"box\" id=\"txtPaymentAddress2\" size=\"50\" maxlength=\"100\"></td> </tr> <tr> <td width=\"150\" class=\"label\">Phone Number</td> <td class=\"content\"><input name=\"txtPaymentPhone\" type=\"text\" class=\"box\" id=\"txtPaymentPhone\" size=\"30\" maxlength=\"32\"></td> </tr> <tr> <td width=\"150\" class=\"label\">Area</td> <td class=\"content\"><input name=\"txtPaymentState\" type=\"text\" class=\"box\" id=\"txtPaymentState\" size=\"30\" maxlength=\"32\"></td> </tr> <tr> <td width=\"150\" class=\"label\">City</td> <td class=\"content\"><input name=\"txtPaymentCity\" type=\"text\" class=\"box\" id=\"txtPaymentCity\" size=\"30\" maxlength=\"32\"></td> </tr> <tr> <td width=\"150\" class=\"label\">Post Code</td> <td class=\"content\"><input name=\"txtPaymentPostalCode\" type=\"text\" class=\"box\" id=\"txtPaymentPostalCode\" size=\"10\" maxlength=\"10\"></td> </tr> </table> <p> </p> <p> </p> <p align=\"center\"> <input class=\"box\" name=\"btnStep1\" type=\"submit\" id=\"btnStep1\" value=\"Proceed >>\"> </p> </form>" } else { //connect to database doDB(); //add records $add_sql = "INSERT INTO tbl_customer (email) VALUES('".$_POST["txtEmail"]."')"; $add_sql = "INSERT INTO tbl_customer (password) VALUES('".$_POST["txtPassword"]."')"; $add_sql = "INSERT INTO tbl_customer (od_shipping_first_name) VALUES('".$_POST["txtShippingFirstName"]."')"; $add_sql = "INSERT INTO tbl_customer (od_shipping_last_name) VALUES('".$_POST["txtShippingLastName"]."')"; $add_sql = "INSERT INTO tbl_customer (od_shipping_address1) VALUES('".$_POST["txtShippingAddress1"]."')"; $add_sql = "INSERT INTO tbl_customer (od_shipping_address2) VALUES('".$_POST["txtShippingPhone"]."')"; $add_sql = "INSERT INTO tbl_customer (od_shipping_phone) VALUES('".$_POST["txtShippingState"]."')"; $add_sql = "INSERT INTO tbl_customer (od_shipping_city) VALUES('".$_POST["txtShippingCity"]."')"; $add_sql = "INSERT INTO tbl_customer (od_shipping_state) VALUES('".$_POST["txtShippingState"]."')"; $add_sql = "INSERT INTO tbl_customer (od_shipping_postal_code) VALUES('".$_POST["txtShippingPostalCode"]."')"; $add_sql = "INSERT INTO tbl_customer (od_payment_first_name) VALUES('".$_POST["txtPaymentFirstName"]."')"; $add_sql = "INSERT INTO tbl_customer (od_payment_last_name) VALUES('".$_POST["txtPaymentLastName"]."')"; $add_sql = "INSERT INTO tbl_customer (od_payment_address1) VALUES('".$_POST["txtPaymentAddress1"]."')"; $add_sql = "INSERT INTO tbl_customer (od_payment_address2) VALUES('".$_POST["txtPaymentPhone"]."')"; $add_sql = "INSERT INTO tbl_customer (od_payment_phone) VALUES('".$_POST["txtPaymentState"]."')"; $add_sql = "INSERT INTO tbl_customer (od_payment_city) VALUES('".$_POST["txtPaymentCity"]."')"; $add_sql = "INSERT INTO tbl_customer (od_payment_state) VALUES('".$_POST["txtPaymentState"]."')"; $add_sql = "INSERT INTO tbl_customer (od_payment_postal_code) VALUES('".$_POST["txtPaymentPostalCode"]."')"; $add_res = mysqli_query($mysqli, $add_sql) or die(mysqli_error($mysqli)); $display_block = "<p>Thanks for signing up!</p>"; } ?> Awesome, after stripping off about 90% of my code, I found a tiny little error that made the whole thing not work. It was a form error. lol. So I have it working as a tiny skeleton now where it can return data matched LIKE a date of birth in database. But when it doesn't, it is supposed to echo "Sorry there was nothing in db matching that". But that message never appears. Please any advice appreciated. thank you. and that will be it for the night/morning now. lol Code: [Select] <?php $host = " "; $database = " "; $username = " "; $password = " *"; $tbl_name = "users"; $conn = mysql_connect($host, $username, $password) or die("Could not connect: " . mysql_error()); mysql_select_db($database); if(isset($_POST['submit'])) { $dob= $_POST['dob']; $result = mysql_query("SELECT * FROM users WHERE dob LIKE '%$dob'"); if ($result) { while($row = mysql_fetch_array($result)) { echo $row['dob'] ; echo "<br />"; echo "CONGRATS!! you found one matching date of birth in the DB!"; } } else { echo "<br/> sorry ". $dob . "for date of birth is not in the database"; } } ?> <html> <body> <form action="login_successBACKUP02.php" method="post"> <input name="dob" type="text" size="20" id="dob" /> Date of Birth<br /> <input type="submit" name="submit" value="Search database" /> <input type="reset" value="Reset fields" /> </form> </body> </html> I am trying to insert with a form the information below into the database, but I don't know how to link it to a specific user in the DB. Below is the SQL dump and my code for the insert page. Any help greatly appreciated. also, I get the error ,"duplicate entry for key 2" Code: [Select] - phpMyAdmin SQL Dump -- version 2.8.0.1 -- http://www.phpmyadmin.net -- -- Host: custsql-sl07.eigbox.net -- Generation Time: Aug 28, 2011 at 07:42 AM -- Server version: 5.0.91 -- PHP Version: 4.4.9 -- -- Database: `photo_artists` -- -- -------------------------------------------------------- -- -- Table structure for table `images` -- CREATE TABLE `images` ( `image_id` bigint(20) unsigned NOT NULL auto_increment, `gallery_user` int(11) NOT NULL, `filename` varchar(255) NOT NULL, `mime_type` varchar(255) NOT NULL, `file_size` int(11) NOT NULL, `file_data` longblob NOT NULL, PRIMARY KEY (`image_id`), UNIQUE KEY `image_id` (`image_id`), KEY `filename` (`filename`), KEY `gallery_user` (`gallery_user`) ) ENGINE=MyISAM AUTO_INCREMENT=38 DEFAULT CHARSET=latin1 AUTO_INCREMENT=38 ; -- Table structure for table `users` -- CREATE TABLE `users` ( `id` int(11) NOT NULL auto_increment, `status` varchar(20) NOT NULL, `lastname` varchar(50) NOT NULL, `dob` date NOT NULL, `gender` varchar(10) NOT NULL, `username` varchar(20) NOT NULL, `password` varchar(60) NOT NULL, `email` varchar(20) NOT NULL, `activationkey` varchar(100) NOT NULL, `sex` varchar(10) NOT NULL, `race` varchar(40) NOT NULL, `job` varchar(40) NOT NULL, `country` varchar(30) NOT NULL, `state` varchar(30) NOT NULL, `town` varchar(30) NOT NULL, `hobbies` mediumtext NOT NULL, `business` varchar(50) NOT NULL, `religion` varchar(40) NOT NULL, `social_groups` mediumtext NOT NULL, `political_groups` varchar(200) NOT NULL, `other_affiliations` varchar(200) NOT NULL, `buying` longtext NOT NULL, `selling` longtext NOT NULL, `links` varchar(100) NOT NULL, `likes` mediumtext NOT NULL, `dislikes` longtext NOT NULL, `firstName` varchar(30) NOT NULL, `zip` varchar(15) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`), UNIQUE KEY `email` (`email`), UNIQUE KEY `activationkey` (`activationkey`) ) ENGINE=MyISAM AUTO_INCREMENT=54 DEFAULT CHARSET=latin1 AUTO_INCREMENT=54 ; -- -- Dumping data for table `users` -- INSERT INTO `users` VALUES (49, 'verify', '', '0000-00-00', '', 'user2', '32b3491336522e073489725b5daf298cd749007a', '1@aol.com', '34705256317118179901016541118525481318594628324', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); INSERT INTO `users` VALUES (53, '', '', '0000-00-00', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); INSERT INTO `users` VALUES (52, 'activated', '', '0000-00-00', '', 'user', 'e8ee80e34d93d48813b08949c07fc826a1c82b63', '1@hotmai', '153967352213317143421219669520489072241284552824', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); and here is the code. note I don't know how to link the insert to the current user. Code: [Select] <?php require_once('globals.php'); include('bouncer.php'); $first = $_POST['first']; $last = $_POST['last']; $first = $_POST['dob']; $last = $_POST['gender']; $first = $_POST['ethnic']; $last = $_POST['country']; $first = $_POST['state']; $last = $_POST['town']; $first = $_POST['zip']; $last = $_POST['mail']; $first = $_POST['job']; $last = $_POST['business']; $first = $_POST['religion']; $last = $_POST['social']; $first = $_POST['political']; $last = $_POST['affiliations']; $first = $_POST['political']; $last = $_POST['affiliations']; $first = $_POST['buying']; $last = $_POST['selling']; $first = $_POST['likes']; $last = $_POST['dislikes']; $first = $_POST['links']; $currentUser = $_SESSION['myusername']; mysql_query ( "INSERT INTO users (lastname, firstName, dob, gender, email, race, job, country, state, town, zip, hobbies, business, religion, social_groups, political_groups, other_affiliations, buying, selling, links, likes, dislikes) VALUES ('$last','$first','$dob','$gender','$email','$ethnic','$job','$country','$state','$town','$zip','$hobbies','$business', '$religion','$social','$political','$affiliations','$buying','$selling','$links','$likes','$dislikes')"); echo mysql_error(); mysql_close(); ?> <html> <body> <p>Login Successful</p> <p> </p> <form action="login_success.php" method="post"> <p> <input type="text" name="first" size="20" /> First name<br /> <input type="text" name="last" size="20" /> Last name<br /> <input name="dob" type="text" size="20" id="dob" /> Date of Birth<br /> <input type="text" name="gender" size="20" id="gender" /> Gender <br /> <input type="text" name="ethnic" size="20" id="ethnic" /> Ethnicity <br /> <input type="text" name="country" size="20" id="country" /> Country<br /> <input type="text" name="state" size="20" id="state" /> State<br /> <input type="text" name="town" size="20" id="town" /> Town<br /> <input type="text" name="zip" size="20" id="zip" /> Zip Code<br /> <br /> <input type="text" name="email" size="40" id="email" /> Email<br /> <textarea name="job" cols="40" id="job"></textarea> Job<br /> <textarea name="business" cols="40" id="business"></textarea> Business<br /> <input type="text" name="religion" size="60" id="religion" /> Religion</p> <p><br /> <textarea name="social" cols="100" id="social"></textarea> Social Groups<br /> <textarea name="political" cols="100" id="political"></textarea> Political groups<br /> <textarea name="affiliations" cols="100" id="affiliations"></textarea> Other Affiliations<br /> <textarea name="buying" cols="100" id="buying"></textarea> Items I am buying<br /> <textarea name="selling" cols="100" id="selling"></textarea> Items I am selling<br /> <textarea name="likes" cols="100" id="likes"></textarea> My likes <br /> <textarea name="dislikes" cols="100" id="dislikes"></textarea> My dislikes <br /> <textarea name="links" cols="100" id="links"></textarea> My links <br /> <input type="submit" value="Store in database and search" /> <input type="reset" value="Reset fields" /> </p> </p> </form> <p><a href="index.php">HOME</a></p> <p>Welcome to members page. to log out click <a href="Logout.php">HERE. </a></p> </body> </html> Hello,
I have made a simple form, which displays an input first, you have to enter a number, then a dynamic form show up with a dynamic part where the number and name of fields vary depending on the number entered first.
In the action page, i have a problem, when i try to display the data in each field, i don't succeed, i get a message
Notice: Array to string conversion
My code is the following :
<h1>Training Reports</h1> <hr /> <form action="" method="post"> Type the number of SEALs : <input type="number" name="nofseals"/> <input type="submit" name="submitn" value="Submit" /> </form> <?php if(isset($_POST['submitn'])){ $numberofseals=$_POST['nofseals']; $numberoffields = 0; echo "<form name=\"report\" action=\"reporta.php\" method=\"post\" style=\"text-align:left;\"> <div style=\"margin-left: 50%;\">Training # <input type=\"number\" name=\"number\"/></div> <br><br> <input type=\"number\" name=\"nos\" value=\"$numberofseals\" style=\"display: none;\"/> <input type=\"number\" name=\"nof\" value=\"$numberoffields\" style=\"display: none;\"/> <h3>Date</h3> <input type=\"date\" name=\"date\" placeholder=\"Date\"/> <h3>Training Type</h3> <textarea name=\"type\" rows=\"2\" placeholder=\"Training Type...\" ></textarea> <h3>Training Duration</h3> <input type=\"time\" name=\"duration\" placeholder=\"Training Duration\"/> <h3>Training Details</h3> <textarea name=\"details\" rows=\"8\" placeholder=\"Training Details...\" ></textarea> <h3>Screenshots</h3> <textarea name=\"ss\" rows=\"1\" placeholder=\"Screenshots links...\" ></textarea> <h2>Participants Marks and Comments</h2>"; while ($numberoffields < $numberofseals) { $numberoffields++; echo "<h3>SEAL $numberoffields : <input type=\"text\" name=\"n[$numberoffields]\" placeholder=\"SEAL Name\"/></h3> <div style=\"margin-left: 20px;\"> Behavior :<input type=\"text\" name=\"b[$numberoffields]\" placeholder=\"Behavior Mark\"/><br> Skills: <input type=\"text\" name=\"m[$numberoffields]\" placeholder=\"Skills Mark\"/><br> Comments: <textarea name=\"c[$numberoffields]\" rows=\"1\" placeholder=\"Comments\"></textarea></div> <br><br>";} echo "<input type=\"submit\" name=\"submit\" value=\"Submit\" />";} ?>Action page : <?php if(isset($_POST['submit'])){ $noofseals=$_POST['nos']; $number=$_POST['number']; $date=$_POST['date']; $type=$_POST['type']; $details=$_POST['details']; $duration=$_POST['duration']; $ss=$_POST['ss']; $numero=0; $c{$numero}=$_POST['c']; $m{$numero}=$_POST['m']; $b{$numero}=$_POST['b']; $n{$numero}=$_POST['n']; echo "[center][color=#2D3C0F][size=20pt][glow=black,2,100][font=georgia]TRAINING REPORT #[/font][/glow][/size][/color][/center] [b][color=navy]Date:[/color][/b]$date [b][color=navy]Type of training:[/color][/b]$type [b][color=navy]How long it lasted:[/color][/b]$duration [b][color=navy]Training details:[/color][/b]$details [b]Screenshots:(optional)[/b]$ss [b][color=navy]SEALs perfomance[/color][/b] [list]"; while($numero < $noofseals) { $numero++; echo "[li][b][color=blue]Seal [$nn]:[/color][/b] [b]Behavior:[/b] [b]Skills:[/b] [b]Comments:[/b] [/li]"; }} echo"[/list]"; ?> Hi, I've got a pdf catalog which posts an order to a php form. The idea is that that the php page looks like an order form that the client can check before finally hitting 'submit' (i.e. along the lines of go to shopping cart). I'd like the php page to be editable. Meaning clients can not only look at their echoed order, but change it before committing to it. So the catalog order gets put into a php submit form with editable fields. I've read that others have accomplished this with statements like: Code: [Select] value="<?php echo $clientName; ?>" Which should fill the client name input box on the order form with the posted variable. But it doesn't work properly for me, instead, the form field is filled with "<?xml version=" with the expected name on the line benath the input box and " /> on the line beneath that. Placing the input box declaration entirely within php tags doesn't work either (exactly the same output). Code: [Select] <?php echo ("Name: <input class=\"inputbox\" type=\"text\" name=\"clientName\" maxlength=\"40\" value=\"$clientName\"><br>"); ?> Can anyone help? Steve Hey All, Our web server appears to be getting hacked by a third part and I think they are getting in via a PHP contact form. They are planting a .htaccess file in the root folder redirecting the pages to a blank one. Can anyone give me advice on the best course of action to take. I can post our PHP code if needed. Many Thanks Hello everyone, this is my first post here! My question covers a PHP, SQL, and HTML so I apologise if this isn't the appropriate section to post this message. Outline to my problem: A user can search my database for a variety of events, which are then listed on a results form. Next to each result I have an option to add this event to the users personal area as a 'saved event' for future reference. Currently I have a solution whereby an HTML form sends an action to '#', inserts the event ID and member ID into the 'savedevent' table via a PHP/SQL function. The page then displays 'event added'. THIS WORKS. However, if the user navigates away from the page, and then back to it again, the PHP script is obviously run again, ie- a 'resend data' dialog box is displayed to the user, which I really don't want. This website:http://www.bandsintown.com/event/3988178-nme-awards-tour-2011-london-united-kingdom-live-at-o2-academy-brixton-on-february-19-2011 achieves exactly what I am trying to do with the 'attending' button, but I cannot figure out how they accomplish this. Any help and ideas would be greatly appreciated. Hello again, and thanks! paddyfields. I'm always getting the "Falha ao selecionar o usuario no banco de dados." error. Why??? Another thing, any tip to improve my code? A way to do the same thing, but with a "more clean" code... login.php Code: [Select] <?php session_start(); require_once('../includes/link.php'); include('../functions/clean.php'); $errmsg_arr = array(); $errflag = false; $email = clean($_POST['email']); $password = clean($_POST['password']); if(($email == '') OR ($password == '')) { $errmsg_arr[] = 'Por favor, preencha todos os campos.'; $errflag = true; $_SESSION['ERRMSG_ARR'] = $errmsg_arr; session_write_close(); header("location: ../index.php"); exit(); } $query = "SELECT * FROM users WHERE email = '$email' AND passwd = '".md5($_POST['password'])."'"; $result = mysql_query($query); $user = mysql_fetch_assoc($result); if($result) { if(mysql_num_rows($result) == 1) { $user = mysql_fetch_assoc($result); session_regenerate_id(); $_SESSION['SESS_ID'] = $user['id']; $_SESSION['SESS_STATUS'] = $user['status']; $_SESSION['SESS_SCHOOL_ID'] = $user['school_id']; $_SESSION['SESS_CLASS_ID'] = $user['class_id']; $_SESSION['SESS_NAME'] = $user['name']; $_SESSION['SESS_REGISTRATION'] = $user['registration']; $_SESSION['SESS_EMAIL'] = $user['email']; session_write_close(); if($_SESSION['SESS_STATUS'] == 1) { header("location: ../users/superadministrator/index.php"); exit(); } } else { $errmsg_arr[] = 'Suas informacoes de login estao incorreta. Por favor, tente novamente.'; $errflag = true; $_SESSION['ERRMSG_ARR'] = $errmsg_arr; session_write_close(); header("location: ../index.php"); exit(); } } else { die("Falha ao selecionar o usuario no banco de dados."); } ?> link.php Code: [Select] <?php define('DB_HOST', 'localhost'); define('DB_USER', 'root'); define('DB_PASSWORD', ''); define('DB_DATABASE', 'social_escola'); $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if (!$link) { die('Falha ao conectar ao servidor: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if (!$db) { die('Falha ao selecionar o banco de dados: ' . mysql_error()); } ?> clean.php Code: [Select] <?php function clean($str) { $str = @trim($str); if(get_magic_quotes_gpc()) { $str = stripslashes($str); } return mysql_real_escape_string($str); } ?> Hello you awesome coders.
I am getting a strange mesage on this site and need some help if you can to fix.
the site is showing this error
Notice: Undefined index: Submit in E:\Domains\a\aet.uk.net\user\htdocs\contact.php on line 84
at this page; http://aet.uk.net/contact.php
Can you help! the form wont post or work.
cheers
chris
<?php include_once("photoman/common.php");?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...nsitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <?php include("includes/header.php"); ?> <script language="JavaScript" type="text/javascript" src="<?php echo $pref ?>scripts/formcheck.js"></script> </head> <body> <?php include("includes/banner.php"); ?> <div id="content" class="<?php echo $sectname ?>"> <?php $pageimage = "includes/$sectname.swf"; if (file_exists($pageimage)) { ?> <script type="text/javascript"> AC_FL_RunContent( 'codebase','http://download.macr...t','197','title','<?php echo $sectname." page" ?>','src','includes/<?php echo $sectname ?>','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','includes/<?php echo $sectname ?>' ); //end AC code </script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macr...ersion=7,0,19,0" width="789" height="197" title="<?php echo $sectname." page" ?>"> <param name="movie" value="includes/<?php echo $sectname ?>.swf" /> <param name="quality" value="high" /> <embed src="includes/<?php echo $sectname ?>.swf" quality="high" pluginspage="http://www.macromedi.../getflashplayer" type="application/x-shockwave-flash"></embed> </object></noscript> <?php } else { $pageimage = "includes/$sectname.jpg"; $pagemax = 250; if (file_exists($pageimage)) { list($sw, $sh, $type, $attr) = getimagesize($pageimage); printf("<div id='pagephoto'><img src=%s alt='%s' %s></div>", $pageimage, $sectname." page image", $attr ); } else { $pageimage = "includes/$sectname.gif"; if (file_exists($pageimage)) { list($sw, $sh, $typwe, $attr) = getimagesize($pageimage); printf("<div id='pagephoto'><img src=%s %s></div>", $pageimage, $attr); } } } ?> <?php $submenu = getMenuXML($sectname); if (count($submenu) > 0 ) { ?> <ul> <?php foreach ($submenu as $subitem) { $imagename = $subitem['image']; if ($imagename == "") { ?> <li><a href="<?php echo $pref ?><?php echo $subitem['href']; ?>"> <?php echo $subitem['name']; ?> </a> </li> <?php } else { ?> <li><a href="<?php echo $pref ?><?php echo $subitem['href']; ?>" onmouseover="MM_swapImage('<?php echo $imagename; ?>','','<?php echo $pref ?>images/<?php echo $subitem['rollover']; ?>',1)" onmouseout="MM_swapImgRestore()"> <img src="<?php echo $pref ?>images/<?php echo ($pagename == $sectname)?$subitem['rollover']:$subitem['image']; ?>" alt="<?php echo $subitem['name']; ?>" id="<?php echo $imagename; ?>" /> </a></li> <?php } } } ?> <div id="pagetext"> <?php $pagefile = "includes/$filename.htm"; if (file_exists($pagefile)) { $text = file_get_contents($pagefile); echo($text); } else { ?> <?php } ?> <?php if($_POST['Submit'] == "Send") { ?> <h2>Thank you for your interest1</h2> <p>We will contact you shortly.</p> <?php // send email $gall = new GalleryXML(); $mailsubj = "Enquiry from ".$gall->gettitle(); $mailto = $gall->getemail(); $mailhead = "From: ".$_POST['email']; $mailbody = "Enquiry from ".$gall->gettitle()."\n"; $mailbody = $mailbody."Name: \t".$_POST['name']."\n"; $mailbody = $mailbody."Phone: \t".$_POST['phone']."\n"; $mailbody = $mailbody."Email: \t".$_POST['email']."\n"; $mailbody = $mailbody."Message: \t".$_POST['message']."\n"; if ($debug) printf("Email message<br>To: %s<br>Subj: %s<br>Email body: %s<br> Header: %s<br>", $mailto, $mailsubj, $mailbody, $mailhead); mail($mailto, $mailsubj, $mailbody, $mailhead); } ?> <table width="50%"> <form action="<?php echo($PHP_SELF)?>" method="post" enctype="multipart/form-data" name="contactform" onSubmit="RGB_validateForm('name','','R','phone','','RisPhone','email','','RisEmail');return document.MM_returnValue"> <tr> <th scope="row">Name</th> <td><input name="name" type="text" id="name" size="32"></td> </tr> <tr> <th scope="row">Telephone</th> <td><input name="phone" type="text" id="phone" size="24"></td> </tr> <tr> <th scope="row">Email</th> <td><input name="email" type="text" id="email" size="32"></td> </tr> <tr> <th scope="row">Message</th> <td><textarea name="message" cols="48" rows="6" id="message"></textarea> </tr> <tr> <td> </td> <td><input type="submit" name="Submit" id="Submit" value="Send"> <input type="reset" name="Reset" id="Reset" value="Reset"> </tr> </form> </table> </div> <?php include("includes/footer.php"); ?> </body> </html> Hello everyone , I have form and I am using action create2.php and everything is working when I want to send to my database information through the form .. This are codes : Code: [Select] <form action="create2.php" method="post"> <p>email</p> <input type="text" name="inputPayer_email" value="" /> <br/> <p>Name</p> <input type="text" name="inputFirst_name" value="" /> <br/> <p>Last name</p> <input type="text" name="inputLast_name" value="" /> <br/> <p>Address 1</p> <input type="text" name="inputAddress_street" value="" /> <br/> <p>Address 2</p> <input type="text" name="inputAddress_city" value="" /> <br/> <p>State</p> <input type="text" name="inputAddress_state" value="" /> <br/> <p>Mobile number</p> <input type="text" name="inputcmd" value=""> <br/> <input type="submit" name="submit" value="submit" /> </form> and create2.php code is Code: [Select] <?php $db_host = "mysqlxxx.host.com"; // Place the username for the MySQL database here $db_username = "nia"; // Place the password for the MySQL database here $db_pass = "pass"; // Place the name for the MySQL database here $db_name = "db"; // Run the actual connection here mysql_connect("$db_host","$db_username","$db_pass") or die ("could not connect to mysql"); mysql_select_db("$db_name") or die ("no database"); ?> <?php $Payer_email = $_POST['inputPayer_email']; $First_name = $_POST['inputFirst_name']; $Last_name = $_POST['inputLast_name']; $Address_street = $_POST['inputAddress_street']; $Address_city = $_POST['inputAddress_city']; $Address_state = $_POST['inputAddress_state']; $cmd = $_POST['inputcmd']; mysql_query("INSERT INTO `transactions` ( `payer_email` , `first_name` , `last_name` , `address_street` , `address_city` , `address_state` , `cmd` , ) VALUES (NULL , '$Payer_email', '$First_name', '$Last_name', '$Address_street', '$Address_city', '$Address_state', '$cmd')") or die(mysql_error()); //!!!!!!!!!!!!!!!!!!!!!!!!! Email User the activation link !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $to = "$Payer_email"; $from = "admin@mywebsite.com"; $subject = "Your order .."; //Begin HTML Email Message $message = "Hi $First_name, Thank you , bla bla .. "; //end of message $headers = "From: $from\r\n"; $headers .= "Content-type: text\r\n"; mail($to, $subject, $message, $headers); $msgToUser = "Thank you .. "; include_once 'hvala.php'; exit(); // Close else after duplication checks header('Location: hvala.php'); ?> And this is redirecting me to hvala.php and sending e-mail for those who ordered something .. But when I want to add javascript so I can validate my web form , sending information in database is not working . I named form with "m" and action is create2.php , javascript works but my order form is not sending to my database anything .. Only blank fields in database .. I will give code with javascript , so if anyone see where is mistake , please write on thread .. Thank you in advance Code: [Select] <script type="text/javascript" language="javascript"> <!-- function validateMyForm ( ) { var isValid = true; if ( document.m.inputPayer_email.value == "" ) { alert ( "Insert email" ); isValid = false; } else if ( document.m.inputPayer_email.value.length < 1 ) { alert ( "Insert email" ); isValid = false; } else if ( document.m.inputFirst_name.value == "" ) { alert ( "First name" ); isValid = false; } else if ( document.m.inputLast_name.value == "" ) { alert ( "Last name" ); isValid = false; } else if ( document.m.inputAddress_street.value == "" ) { alert ( "Address" ); isValid = false; } else if ( document.m.inputAddress_city.value == "" ) { alert ( "Address" ); isValid = false; } else if ( document.m.inputAddress_state.value == "" ) { alert ( "State" ); isValid = false; } else if ( document.m.inputcmd.value == "" ) { alert ( "Mobile number" ); isValid = false; } return isValid; } //--> </script> <form name="m" action="create2.php""> <p>email</p> <input type="text" name="inputPayer_email" value="" /> <br/> <p>Name</p> <input type="text" name="inputFirst_name" value="" /> <br/> <p>Last name</p> <input type="text" name="inputLast_name" value="" /> <br/> <p>Address 1</p> <input type="text" name="inputAddress_street" value="" /> <br/> <p>Address 2</p> <input type="text" name="inputAddress_city" value="" /> <br/> <p>State</p> <input type="text" name="inputAddress_state" value="" /> <br/> <p>Mobile number</p> <input type="text" name="inputcmd" value=""> <br/> <input name="button" type="submit" value="Submit Information" onclick="javascript:return validateMyForm();"/> </form> |