PHP - Form Sending Issue
when i click submit the form isnt sending to the dataabse...any help really appreciated!!
heres the code: Code: [Select] <?php session_start(); $errorMsg = ""; if (isset($_POST['billing'])){ include_once "connect_to_mysql.php"; $firstname = preg_replace("[^A-Za-z0-9]", "", $_POST['firstname']); $lastname = preg_replace("[^A-Z a-z0-9]", "", $_POST['Last Name']); $address = preg_replace("[^A-Z a-z0-9]", "", $_POST['address']); $phone = preg_replace("[^A-Z a-z0-9]", "", $_POST['phone']); $creditcard = preg_replace("[^A-Z a-z0-9]", "", $_POST['creditcard']); $expiry = preg_replace("[^A-Z a-z0-9]", "", $_POST['expiry']); $CVV = preg_replace("[^A-Z a-z0-9]", "", $_POST['CVV']); $email = stripslashes($_POST['email']); $email = strip_tags($email); $email = mysql_real_escape_string($email); if((!$firstname) || (!$lastname) || (!$address) || (!$phone) || (!$creditcard) || (!$expiry) || (!$CVV) || (!$email)){ $errorMsg = "You did not submit the following required information!<br /><br />"; if(!$firstname){ $errorMsg .= "--- First Name"; } else if(!$lastname){ $errorMsg .= "--- Last Name"; } else if(!$address){ $errorMsg .= "--- Address"; } else if(!$phone){ $errorMsg .= "--- Phone"; } else if(!$creditcard){ $errorMsg .= "--- Credit Card"; } else if(!$expiry){ $errorMsg .= "--- Expiry"; } else if(!$CVV){ $errorMsg .= "--- CVV"; } else if(!$email){ $errorMsg .= "--- Email Address"; } } else { $id = mysql_insert_id(); $sql = mysql_query("INSERT INTO customer (firstname, lastname, address, phone, creditcard, expiry, CVV, email) VALUES('$firstname','$lastname','$address','$phone','$creditcard','$expiry','$CVV','$email' now())") or die (mysql_error()); print "<br /><br /><br /><h4>OK $firstname, Thanks for Shopping:</h4><br /> We just sent a Confirmation link to: $email<br /><br /> <strong><font color=\"#990000\">Please check your email inbox. Thank You.</font></strong><br />"; 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> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Billing</title> <link href="../dnb2.css" rel="stylesheet" type="text/css" /> </head> <body> <?php include_once("../template_header2.php");?> <table width="600" align="center"> <tr> <td width="7%" align= "center">Billing</td> </tr> </table> <table width="600" align="center" cellpadding="5"> <form action="billing.php" method="post" enctype="multipart/form-data"> <tr> <td colspan="2"><font color="#FF0000"><?php echo "$errorMsg"; ?></font></td> </tr> <tr> <td width="163"><div align="right">First Name:</div></td> <td width="409"><input name="firstname" type="text" value="<?php echo "$firstname"; ?>" /></td> </tr> <tr> <td width="163"><div align="right">Last Name:</div></td> <td width="409"><input name="lastname" type="text" value="<?php echo "$lastname"; ?>" /></td> </tr> <tr> <td width="163"><div align="right">Address:</div></td> <td width="409"><input name="address" type="text" value="<?php echo "$address"; ?>" /></td> </tr> <tr> <tr> <td width="163"><div align="right">Phone:</div></td> <td width="409"><input name="phone" type="text" value="<?php echo "$phone"; ?>" /></td> </tr> <tr> <td><div align="right">Credit Card: </div></td> <td><input name="creditcard" type="text" value="<?php echo "$creditcard"; ?>" /></td> </tr> <tr> <td><div align="right">Expiry: </div></td> <td> <input name="expiry" type="text" value="<?php echo "$expiry"; ?>" /> </td> </tr> <tr> <td width="163"><div align="right">CVV:</div></td> <td width="409"><input name="CVV" type="text" value="<?php echo "$CVV"; ?>" /></td> </tr> <tr> <td><div align="right">Email: </div></td> <td><input name="email" type="text" value="<?php echo "$email"; ?>" /></td> </tr> <tr> <td><div align="right"></div></td> <td><input type="submit" name="Submit" value="Submit Form" /></td> </tr> </form> </table> </body> </html> Similar TutorialsI usually hate to post something like this as a first post...I'd like to at least do an into but I"m stumped and I think it's a totally stupid thing I"m not noticing. Anyway, this is the final step in a three step user verification; this is for a staff user to be verified. Anyway, by now they have already verified their email and entered a random code so I"m only worried about actually setting them to verified status in my database so they can start working on blogs etc. Anyway, this form is supposed to find all unverified staff members, and allow an admin to easily just click down the list (one at a time currently) and verify the user (ie. setting their database status to verified_staffUser). The username that is supposed to be verified (or declined and therefore their entry deleted) is supposed to be passed through as $_POST[vnsupUsername]. This is set each time it loops through and prints a new user. The problem is that it's only sending the final username when I click verify/decline on any user :\. I"m not sure why it's doing this. In firebug on firefox it's showing that the user name is set for each one to be properly in the form...but when I click on it (I am having on my machine) the username being worked with echoed..and it's always the last one that was entered into the database. I have no idea why this is happening ..any thoughts? Code: [Select] <?php if(isset($_GET[vnsufac]) || isset($_POST[svnsu]) || isset($_POST[dvnsu])){ // simply prints the back home button echo "<form action=\"http://localhost/~atharp1122/OGirly_Site/ogirly_staff_homepage.php\" method=\"post\">" ."<input type=\"submit\" value=\"Back to Staff Homepage\" style=\"margin-top:10px;\">"; // this will print out the form to verify/deny all new staff user requests that have been email verified $programCheckUVStaff = mysql_query("SELECT username, email, firstname, lastname FROM staffUNAP where verified_staff = '0'"); while($UVStaff = mysql_fetch_assoc($programCheckUVStaff)){ print "<div class=\"newVerifyUserContain\" >"; print "<div class=\"newVerifyUser\" >"; echo "<h3 style=\"text-align: center;\">Would you like to verify this Staff request?</h3>"; echo "<table><tr><td>" ."<img src=\"images/default_icons/di_bunny_rabbit.png\" width=\"56\" height=\"59\" />" ."<ul style=\"padding-left: 100px; padding-bottom: 20px; margin-top: -42px; list-style-type: none;\"><li>" ."{$UVStaff[username]} aka {$UVStaff[firstname]} {$UVStaff[lastname]}</li><li>" ."{$UVStaff[email]}</li></ul></td></tr><tr><td>" ."<form action=\"{$_SERVER[PHP_SELF]}\" method=\"post\">" ."<input type=\"checkbox\" name=\"isadmin\" value=\"1\" style=\"margin-left: 10px;\">Is Admin?" ."<input type=\"hidden\" name=\"vnsupUsername\" value=\"{$UVStaff['username']}\">" ."<input type=\"submit\" name=\"svnsu\" value=\"Verify Staff\" style=\"margin-left: 200px;\">" ."<input type=\"submit\" name=\"dvnsu\" value=\"Decline Request\">"; print "</table>"; print "</div></div>"; } } // verify a staff member if(isset($_POST[svnsu])){ echo "verifying a new user"; echo $_POST[vnsupUsername]; } ?> I have a form that has a section where you can pick multiple check boxes and when the info is returned to me it has the word Array at the end of it. There are 2 check boxes on the form one fo Steve and one for Ben Below is the code I am using in my PHP file foreach($_POST['TestGroup'] as $val) { echo $val . "\n"; } The output from the PHP code is----Steve Ben Array.------ How do I keep Array from coming up? Hi I have a html form page linked to a .php page for sending me and the user the data entered in to the from: Part of the code for example purposes: HTML SIDE <form method="post" action="thankyou.php"> <?php $ipi = getenv("REMOTE_ADDR"); $httprefi = getenv ("HTTP_REFERER"); $httpagenti = getenv ("HTTP_USER_AGENT"); ?> <input name="visitormail" type="text" size="25" /> <input name="button" type="submit" id="button" value="Send" /> </form> PHP SIDE SENDING <?php $visitormail = $_POST['visitormail']; $from = "From: $visitormail\r\n"; $from = "Cc: $visitormail\r\n"; mail("forum@domain.co.uk", $subject, $message, $from); ?> What is happening is the incoming mail is coming in to me and to the user from "forum@domain.co.uk" but from my ISP domain? After lots of searching I have come up with the answer that I should be using "PHP mail() and SMTP Authentication" ? Is this the case and if so how do I set up SMTP Authentication as I am new to php!!!!! Thanks Gary ...to obtain an id_item users doesn´t know and I need to send to the DB
I got this
<?php require_once('Connections/conexxion.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO movimiento (venta, compra, taller, regula_mas, regula_menos, id_lente, id_cil, id_esf) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['venta'], "int"), GetSQLValueString($_POST['compra'], "int"), GetSQLValueString($_POST['taller'], "int"), GetSQLValueString($_POST['regula_mas'], "int"), GetSQLValueString($_POST['regula_menos'], "int"), GetSQLValueString($_POST['id_lente'], "int"), GetSQLValueString($_POST['id_cil'], "int"), GetSQLValueString($_POST['id_esf'], "int")); mysql_select_db($database_conexxion, $conexxion); $Result1 = mysql_query($insertSQL, $conexxion) or die(mysql_error()); } mysql_select_db($database_conexxion, $conexxion); $query_lente = "select id_lente, lente from lentes"; $lente = mysql_query($query_lente, $conexxion) or die(mysql_error()); $row_lente = mysql_fetch_assoc($lente); $totalRows_lente = mysql_num_rows($lente); mysql_select_db($database_conexxion, $conexxion); $query_esfera = "SELECT * FROM esfera"; $esfera = mysql_query($query_esfera, $conexxion) or die(mysql_error()); mysql_select_db($database_conexxion, $conexxion); $query_cilindro = "SELECT * FROM cilindro"; $cilindro = mysql_query($query_cilindro, $conexxion) or die(mysql_error()); $query_item = "select id_item from item inner join rx on rx.id_rx = item.id_rx inner join cilindro on cilindro.id_cil = rx.id_cil inner join esfera on esfera.id_esf = rx.id_esf where cilindro = ".$_POST['sel_cil']." and esfera = ".$_POST['sel_esf']." and id_lente =". $_POST['sel_lente']; $idlente = mysql_query($query_lente, $conexxion) or die (mysql_error()); ?> <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1"> <table align="center"> <tr valign="baseline"> <td nowrap="nowrap" align="right">Venta:</td> <td><input type="text" name="venta" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Compra:</td> <td><input type="text" name="compra" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Taller:</td> <td><input type="text" name="taller" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Regula_mas:</td> <td><input type="text" name="regula_mas" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Regula_menos:</td> <td><input type="text" name="regula_menos" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">lente:</td> <td><?php echo "<select name='sel_lente'>"; while($row= mysql_fetch_array($lente)){?> <option value=" <?php echo $row['id_lente'] ;?> " > <?php echo $row['lente']; ?> </option> <?php } ?> </select> <label for="id_lente"></label></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">cilindro:</td> <td><?php echo "<select name='sel_cil'>"; while($row= mysql_fetch_array($cilindro)){?> <option value=" <?php echo $row['id_cil'] ;?> " > <?php echo $row['cilindro']; ?> </option> <?php } ?> </select> <label for="id_cil"></label></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Esfera:</td> <td><?php echo "<select name='sel_esf'>"; while($row= mysql_fetch_array($esfera)){?> <option value=" <?php echo $row['id_esf'] ;?> " > <?php echo $row['esfera']; ?> </option> <?php } ?> </select></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">id_lente</td> <td><label for="id_lente3"></label> <input type="text" name="id_lente" id="id_lente3" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"> </td> <td><input type="submit" value="Insert record" /></td> </tr> </table> <input type="hidden" name="MM_insert" value="form1" /> </form> <?php mysql_free_result($esfera); mysql_free_result($cilindro); mysql_free_result($lente); ?>and with this query $query_item = "select id_item from item inner join rx on rx.id_rx = item.id_rx inner join cilindro on cilindro.id_cil = rx.id_cil inner join esfera on esfera.id_esf = rx.id_esf where cilindro = ".$_POST['sel_cil']." and esfera = ".$_POST['sel_esf']." and id_lente =". $_POST['sel_lente']; $idlente = mysql_query($query_lente, $conexxion) or die (mysql_error());I would obtain the id_item, but , how?, because the form it´s not procesed and I´m getting no variable values. Ok I dont understand why my php form keeps sending me blank emails. Because I have a checker with java script. Did I do something wrong in my coding with the php forms or is it just the javascript on the sites problem? Here is the php form code: Code: [Select] <script language="JavaScript"> function checkForm() { var cname, caddress, cphone, cemail, ccontact; with(window.document.msgform) { cname = name; caddress = address; cphone = phone; cemail = email; ccontact = contact; } if(trim(cname.value) == '') { alert('Please enter your name'); cname.focus(); return false; } else if(trim(caddress.value) == '') { alert('Please enter your address'); cemail.focus(); return false; } else if(trim(cphone.value) == '') { alert('Please enter your phone number'); cemail.focus(); return false; } else if(!isEmail(trim(cemail.value))) { alert('Email address is not valid'); cemail.focus(); return false; } else if(trim(ccontact.value) == '') { alert('Please enter your contact person'); cemail.focus(); return false; } else { cname.value = trim(cname.value); caddress.value = trim(caddress.value); cphone.value = trim(cphone.value); cemail.value = trim(cemail.value); ccontact.value = trim(ccontact.value); return true; } } /* Strip whitespace from the beginning and end of a string Input : a string */ function trim(str) { return str.replace(/^\s+|\s+$/g,''); } /* Check if a string is in valid email format. Returns true if valid, false otherwise. */ function isEmail(str) { var regex = /^[-_.a-z0-9]+@(([-a-z0-9]+\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i; //regex = /^[-_.abcdefghijklmnopqrstuvwxyz0123456789]+@(([-abcdefghijklmnopqrstuvwxyz0123456789]+\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i; return regex.test(str); } </script> <form name="msgform" action="thankyou.php" method="post" > <table width="95%" border="0" cellspacing="1" class="tablestyle" cellpadding="1" align="center"> <tr><td>Name:</td> <td><input type="text" name="name" size="27"> </td> </tr> <tr><td>Address:</td> <td><input type="text" name="address" size="27"> </td> </tr> <tr> <td>Phone: </td> <td> <input type="text" name="phone" size="27"> </td> </tr> <tr> <td>Email: </td> <td> <input type="text" name="email" size="27"> </td> </tr> <tr> <td>Contact Person: </td> <td> <input type="text" name="contact" size="27"> </td> </tr> <tr> <td valign=top>I would like to participate at the: </td> <td valign=top> <input type="radio" name="level" value="5000">Platinum<BR> <input type="radio" name="level" value="2500">Gold<BR> <input type="radio" name="level" value="1000">Silver<br> <input type="radio" name="level" value="500">Bronze <br><br> </td> </tr> <tr> <td> <input type="radio" name="level" value="1250"option5<br> </td> </tr> <tr><td colspan="2"><input type="submit" value="submit" name="submit" onClick="return checkForm();"><input type="reset" value="Reset"></td></tr> </table></form> Here is the php process code: Code: [Select] <?php $con = mysql_connect(""); //Replace with your actual MySQL DB Username and Password if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("sponsorship", $con); //Replace with your MySQL DB Name $name=mysql_real_escape_string($_POST['name']); //This value has to be the same as in the HTML form file $address=mysql_real_escape_string($_POST['address']); //This value has to be the same as in the HTML form file $phone=mysql_real_escape_string($_POST['phone']); //This value has to be the same as in the HTML form file $email=mysql_real_escape_string($_POST['email']); //This value has to be the same as in the HTML form file $contact=mysql_real_escape_string($_POST['contact']); //This value has to be the same as in the HTML form file $level=mysql_real_escape_string($_POST['level']); //This value has to be the same as in the HTML form file $sql="INSERT INTO sponsorship (name,address,phone,email,contact,level) VALUES ('$name','$address','$phone','$email','$contact','$level')"; /*form_data is the name of the MySQL table where the form data will be saved. name and email are the respective table fields*/ if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } ?> <?php $name = $_POST["name"]; $address = $_POST["address"]; $phone = $_POST["phone"]; $email = $_POST["email"]; $contact = $_POST["contact"]; $level = $_POST["level"]; echo "Name: ". $name . " <br />"; echo "Address: ". $address . " <br />"; echo "Phone: ". $phone . " <br />"; echo "Email: ". $email . " <br />"; echo "Contact: ". $contact . " <br />"; echo "Level: ". $level . " and up. <br />"; $recipient = "my email"; $subject = " subject "; $message = " '. name: .'$name '. contact: .' $contact '. address: .' $address '. phone: .' $phone '. email: .' $email '. level: .' $level "; mail($recipient, $subject, $message); ?> i keep thinking its the javascript fault but i have a navigation menu which is made from javascript and it works fine. So it leaves me to think its something i did wrong with the form or php? Can someone help me please? Thank you! Hi i am trying to send a form to an email address but it works at my house but apparently the person i am doing this for says its not working at their home and at work. So this code works at some place. what would i be doing wrong. Here is the form: Code: [Select] <form method="post" action="envoyez.php"> Nom:<br /> <input name="Nom" type="text"><br> Courriel:<br /> <input name="Courriel" type="text"><br> Commentai <br> <textarea name="Commentaire" rows="15" cols="40"></textarea><br> <input type="submit" value="Envoyez"> </form> and here the code to send the email: Code: [Select] <?php $Nom = $_REQUEST['Nom'] ; $Courriel = $_REQUEST['Courriel'] ; $Commentaire = $_REQUEST['Commentaire'] ; mail( "do@notwork.ca", "Commentaire", $Commentaire, "From: $Courriel" ); ?> what am I doing wrong. Because If i send a comment it is working. Can anyone help pls?? Hi all I am working on a filter system that when a user selects a drop down menu item it automatically updates the page taking the value from the form and sending it through the URL parameter to update the page accordingly: <form id="category_filter" name="category_filter" method="post" action=""> <label for="category_filter"></label> <select name="category_filter" id="category_filter" style="width: 160px" onchange="this.form.submit();" > <option value="" selected class="meter-calc-text">Category</option> <?php $fetchcategories=mysql_query("SELECT * FROM `categories` ORDER BY position ASC"); while($returnedcategories=mysql_fetch_array($fetchcategories)) { echo "<option value=\"".$returnedcategories['name']."\" >".$returnedcategories['name']."</option>"; } ?> </select> </form> The only thing is, it doesn't pass the value to the url, it remains blank Many thanks for your help. Pete Hi, I had a website running a few months ago with a working contact form I am now building a new website and have copied the files changing relevant info but it is not not working it is sending me to the thank you page but the email is not coming through. Can anybody see why? <?php $EmailTo = "MYEMAIL@gmail.com"; $Subject = "Contact from Website"; $Title = Trim(stripslashes($_POST['Title'])); $FName = Trim(stripslashes($_POST['First Name'])); $LName = Trim(stripslashes($_POST['Last Name'])); $Email = Trim(stripslashes($_POST['Email'])); // prepare email body text $Body = ""; $Body .= "Title: "; $Body .= $Title; $Body .= "\n"; $Body .= "First Name: "; $Body .= $FName; $Body .= "\n"; $Body .= "Last Name: "; $Body .= $LName; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$Email>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=thankyou.php\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.php\">"; } ?> Code: [Select] <form action="quoteform.php" method="post" enctype="multipart/form-data" name="quoteform" id="quoteform"> <label for="Title" id="Title">Title:</label><select name="Title"> <option value="Mr">Mr</option> <option value="Mrs">Mrs</option> <option value="Miss">Miss</option> <option value="Ms">Ms</option> <option value="Dr">Dr</option> <option value="Other">Other</option> </select> <label for="FName" id="FName">First Name:</label><input name="First Name" type="text" size="25"> <label for="LName" id="LName">Last Name:</label><input name="Last Name" type="text" size="25"> <label for="Email" id="Email">Email:</label><input name="Email" type="text" size="50"> <input type="submit" name="submit" value="Send" class="submit-button" title="Submit" /> <input type="button" value="Clear Message" onClick="document.forms['quoteform'].Message.value=''" /> </form> hello, i have implemented a jquery function like this: http://jsbin.com/ujuse i need to grab the contents of the textarea to store it in a session, but without sending a form, is this possible?? thanks for looking Please help: I'm trying to figure out what is going on with a custom made PHP contact form on my company's multiple websites. Check it out he www.TacticalSolar.com This custom form was made by a former employee and USUALLY works great. Validation, spam checking, database connection, etc. But I've discovered a bug. The form does not always actually send the data to us when it says it does! This problem almost always happens in Internet Explorer and Safari browsers. But sometimes that data shows up. This does not effect Firefox or Chrome. I've been looking everywhere, but no idea what is causing this. Thoughts? Ideas? I'm no PHP coder so even obvious places to look are welcome. Okay, below is my mailer for a contact form i created. On one site it works fine. I even have it sending to several addresses from the othersite. However this site it doesnt want to work. PHP5 and mail() function is active. <?php $Name = Trim(stripslashes($_POST['fullname'])); $EmailFrom = Trim(stripslashes($_POST['email'])); $EmailTo = "james@jd-creations.co.uk"; $Subject = Trim(stripslashes($_POST['subject'])); $answer = Trim(stripslashes($_POST['answer'])); $Comments = Trim(stripslashes($_POST['message'])); $Subject = "The Reason - Contact Us"; // validation $validationOK=true; if (Trim($EmailFrom)=="") $validationOK=false; if (Trim($answer)!=="20") $validationOK=false; if (Trim($Name)=="") $validationOK=false; if (Trim($Comments)=="") $validationOK=false; if (Trim($Subject)=="") $validationOK=false; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=../contact/error2.php\">"; exit; } // prepare email body text $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Email: "; $Body .= $EmailFrom; $Body .= "\n"; $Body .= "Comments: "; $Body .= $Comments; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=../contact/sent.php\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=../contact/error.php\">"; } ?> now i know it is wroking because it takes me to the sent.php page. not error.php i think it worked once. now not at all. Hi, I'm new to PHP and have dabbled a little but need some help or someone to point me in the right direction if possible. I have an ajax web-form that sends the inputed data to a php file and then emails the results to the designated address (all working fine). However, what I am looking to do is have the php file (in addition to the current function) convert the data into XML and then attach the XML file to the email that is sent out. As mentioned I'm new to php and have a small amount of knowledge so any help on this would be very much appreciated. Cheers Hi all I am in the process of creating a product page where the user can type in three initials into a form and then 'clicks add to basket'. The button doesn't use a form just a url: basket.php?action=add&id=1&qty=1 This adds the item into a basket using sessions rather than a database. The question is, how do I add three variables into my form so that they are sent via the URL and into the session? Wil I have to start again with a form? Here's the code: <td class="table-font-grey">Why not make your whip extra special by adding up to three elegantly engraved Kunstler script initials.</td> <td width="42" style="border: 1px solid grey;"><input name="initial_1" type="text" size="8" maxlength="1" height="40px" /></td> <td width="43" style="border: 1px solid grey;"><input name="initial_2" type="text" size="8" maxlength="1" height="40px" /></td> <td width="43" style="border: 1px solid grey;"><input name="initial_3" type="text" size="8" maxlength="1" height="40px" /></td> </tr> <tr> <td height="15"> </td> <td width="328" class="table-font"> </td> <td width="42" align="center" class="table-font">1</td> <td width="43" align="center" class="table-font">2</td> <td align="center" class="table-font">3</td> </tr> <tr> <td> </td> <td colspan="3" class="table-font"> </td> <td align="right" class="table-font"> </td> </tr> </table> <hr /> <p> </p> <table width="494" border="0"> <tr class="table-font"> <td width="263" height="24"> <a href="<?php echo "basket.php?action=add&id=1&qty=1" ?>" title="Add <?php echo $product['name'] ?> to Cart"> <a href="<?php echo WEB_URL."basket.php?action=add&id=1&qty=1" ?>" title="Add <?php echo $product['name'] ?> to Cart"> <img src="<?php echo WEB_URL."images/product-add-button.gif" ?>" alt="Buy <?php echo $product['name'] ?>" /></a> Many thanks Pete EDIT, CORRECTION- IT WENT TO MY JUNKMAIL. HOW DO I PREVENT THAT? ALSO, IT DID NOT PUT THE USER'S IP IN THE 'POSTER' FIELD IN DB SO I CAN PREVENT MULTIPLE POSTS PER PERSON. Hi, I went over the code and looks good to me, I put the "poster" field in my Members table. Everything looks good, my page loads with no errors, but the email never gets sent upon submitting the form "user poll" here is the relevant code, please any help greatly appreciated! thank you. Code: [Select] <?php if($_POST['submit']) { $currentPoster = $_SERVER['REMOTE_ADDR']; // get ip of visitor $query = mysql_query("SELECT * FROM members WHERE poster = '$currentPoster'"); //check DB for user ip if (mysql_num_rows($query) > 0) //if ip exists, user already posted { $error=1; //this is t o set if error message echoes or not. $errorMessage=" You already posted to this poll"; // echo error to the multiple post prick//echoed out below } else { $query2 = mysql_query("INSERT INTO members(poster) VALUES ('$currentPoster')");// insert new ip into DB $email_from = '.info POLL'; // email information $email_subject = " POLL RESPONDER"; $email_body = "You have received a new poll message from the user ip address of $currentPoster.\n". "Here is the message:\n $userfeedback"; //////////////////////////////////////////////////////////////////////// //SEND THE EMAIL $to = "xxxx@hotmail.com"; //email headers $headers = "From: $email_from \r\n"; $headers .= "Reply-To: no one \r\n"; mail($to,$email_subject,$email_body,$headers);// sends off the final email. $error=0; $goodmessage="Thank you for your feedback!"; } } ?> <form id="userfeedback" method="post" action="index.php"> <p> <textarea name="userfeedback" id="userfeedback" cols="45" rows="5"></textarea> <input type="submit" id="submit" name="submit"/> <input type="reset" id="reset" name="reset"/> </p> </form> <br/> <?php if($error=1) { echo $errorMessage; }else { echo $goodmessage; } ?> I have made an order form in html and i want to send the content of the form to an email adres. I tried some things already with php but i can't seem to get it right. Can anyone help me with this order form?
Hello, I'm new to PHP but i am quite good with javascript programming etc so i'm just getting to terms with using PHP. I've made a contact form with an IF statement that will display confirmation within my page upon post. (I'm not even sure if this logic is right however). The form seems to submit but doesn't show the confirmation message and doesn't send an email to my webserver. Code: [Select] <body> <div id="outer"> <div id="topbar"> </div> <div id="topback"> <img src="images/logo.png" class="logo" /> <a href="index.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('hemcurrent','','images/homecurrent.png',1)"><img src="images/home.png" class="logo hem" name="hemcurrent" /></a> <a href="Tjanster.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('tjanstercurrent','','images/tjanstercurrent.png',1)"><img src="images/tjanster.png" class="logo links" name="tjanstercurrent" /></a> <a href="OmOss.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('omosscurrent','','images/omosscurrent.png',1)"><img src="images/omoss.png" class="logo links" name="omosscurrent" /></a> <a href="Referenser.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('referensercurrent','','images/referensercurrent.png',1)"><img src="images/referenser.png" class="logo links" name="referensercurrent" /></a> <a href="KontaktaOss.html"><img src="images/kontaktaosscurrent.png" class="logo links" /></a> </div> <div id="maincontent"> <h1>Nordströms HRK AB - </h1> <h2 class="kontaktaoss"> KONTAKTA OSS</h2> <?php if ($_POST["email"]<>'') { $ToEmail = 'michel@hissorulltrappskonsulter.se'; $EmailSubject = 'Webform Hissorulltrapp'; $mailheader = "From: ".$_POST["email"]."\r\n"; $mailheader .= "Reply-To: ".$_POST["email"]."\r\n"; $mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n"; $MESSAGE_BODY = "Name: ".$_POST["name"].""; $MESSAGE_BODY .= "Email: ".$_POST["email"].""; $MESSAGE_BODY .= "Comment: ".nl2br($_POST["comment"]).""; mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure"); ?> Your message has been sent <?php } else { ?> <form name="form" id="form" action="KontaktaOss.php" method="post"> <select name="sDepartment" onchange="MM_jumpMenu('parent',this,0)" class="selectDepartment"> <option>Hiss och rulltrappstjänster</option> <option>Teknisk support</option> </select> <input type="text" name="subject" id="name" class="txtDepartment" /> <textarea name="tComments" id="comment" class="txtComments"></textarea> <input type="text" name="tEmail" id="email" class="txtEmail" /> <input type="image" src="images/submit.png" class="bSubmit" value="send" /> <input type="image" src="images/reset.png" class="bReset" /> </form> <?php }; ?> <p class="kontaktaossdetails"><b>Information:</b><br /> Stationsvägen 4C<br /> Täby 187 30 <br /> Telefon: 0702698981<br /> bjorn@hissotrulltrappskonsulter.se<br /> michel@hissorulltrappskonsulter.se<br /> <b>Teknisk Support:</b><br /> joel@hissorulltrappskonsulter.se</p> </div> <div id="tagline"><img class="quote1" src="images/quote1.png" /> <div id="elem0" class="toBeFaded tagline"><p> Björn har under sin anställning utvecklat en gedigen kompetens inom sitt arbetsområde. Han har i sin roll visat stort engagemang för sina arbetsuppgifter.. -<em> Harry Plogbäck, Teknisk förvaltningschef - AB Storstockholms Lokaltrafik</em></p></div> <div id="elem1" class="toBeFaded tagline"><p>Behovet av kvalitetskontroller erinrar sig från värdet av en kontrollverksamhet jämtemot de som utför reparationer och service. Det skapar även möjligheten... -<em> Björn Anderson, Teknisk förvaltningschef - AB Storstockholms Lokaltrafik</em></p></div> <div id="elem2" class="toBeFaded tagline"><p>Angående utförandet av arton kvalitetskontroller samt rådgivning för PUB, Atrium Fastigheter. “Rulltrappskonsulterna har hjälpt mig att få fram en rättvis bild... -<em> Stefan Fransson, Teknisk förvaltare för PUB, Atrium Fastigheter AB</em></p></div> <div id="elem3" class="toBeFaded tagline"><p> Björn har under sin anställning utvecklat en gedigen kompetens inom sitt arbetsområde. Han har i sin roll visat stort engagemang för sina arbetsuppgifter.. -<em> Harry Plogbäck, Teknisk förvaltningschef - AB Storstockholms Lokaltrafik</em></p></div> <div id="elem4" class="toBeFaded tagline"><p>Behovet av kvalitetskontroller erinrar sig från värdet av en kontrollverksamhet jämtemot de som utför reparationer och service. Det skapar även möjligheten... -<em> Björn Anderson, Teknisk förvaltningschef - AB Storstockholms Lokaltrafik</em></p></div> <div id="elem5" class="toBeFaded tagline"><p>Angående utförandet av arton kvalitetskontroller samt rådgivning för PUB, Atrium Fastigheter. “Rulltrappskonsulterna har hjälpt mig att få fram en rättvis bild... -<em> Stefan Fransson, Teknisk förvaltare för PUB, Atrium Fastigheter AB</em></p></div> <div id="elem6" class="toBeFaded tagline"><p> Björn har under sin anställning utvecklat en gedigen kompetens inom sitt arbetsområde. Han har i sin roll visat stort engagemang för sina arbetsuppgifter.. -<em> Harry Plogbäck, Teknisk förvaltningschef - AB Storstockholms Lokaltrafik</em></p></div> <div id="elem7" class="toBeFaded tagline"><p>Behovet av kvalitetskontroller erinrar sig från värdet av en kontrollverksamhet jämtemot de som utför reparationer och service. Det skapar även möjligheten... -<em> Björn Anderson, Teknisk förvaltningschef - AB Storstockholms Lokaltrafik</em></p></div> <div id="elem8" class="toBeFaded tagline"><p>Angående utförandet av arton kvalitetskontroller samt rådgivning för PUB, Atrium Fastigheter. “Rulltrappskonsulterna har hjälpt mig att få fram en rättvis bild... -<em> Stefan Fransson, Teknisk förvaltare för PUB, Atrium Fastigheter AB</em></p></div> <div id="elem9" class="toBeFaded tagline"><p> Björn har under sin anställning utvecklat en gedigen kompetens inom sitt arbetsområde. Han har i sin roll visat stort engagemang för sina arbetsuppgifter.. -<em> Harry Plogbäck, Teknisk förvaltningschef - AB Storstockholms Lokaltrafik</em></p></div> <div id="elem10" class="toBeFaded tagline"><p>Behovet av kvalitetskontroller erinrar sig från värdet av en kontrollverksamhet jämtemot de som utför reparationer och service. Det skapar även möjligheten... -<em> Björn Anderson, Teknisk förvaltningschef - AB Storstockholms Lokaltrafik</em></p></div> <div id="elem11" class="toBeFaded tagline"><p>Angående utförandet av arton kvalitetskontroller samt rådgivning för PUB, Atrium Fastigheter. “Rulltrappskonsulterna har hjälpt mig att få fram en rättvis bild... -<em> Stefan Fransson, Teknisk förvaltare för PUB, Atrium Fastigheter AB</em></p></div> <img class="quote2" src="images/rightquote.png" /> <img src="images/btnLogin.png" class="btnlogin" /> </div> <div id="copyright"> <ul id="nav"> <li>LANGUAGES: </li> <li><a href="#">ENGLISH</a></li> <li><a href="#">SWEDISH</a></li> <li><a href="#">HELP</a></li> <li>COPYRIGHT BY NORDSTRÖMS HRK AB</li> </ul> </div> <div id="mac"> <div id="macscreen"> <iframe width="336" height="216" src="http://www.youtube.com/embed/AhfK9_ZlRXQ?hl=en&fs=1&rel=0&autoplay=1&autohide=1&showinfo=0&controls=0&loop=1" frameborder="0"></iframe> </div> </div> </div> </body> Just looking for some advice really, i'm sure it's something very simple! Thank you. Ok, I have tried using the code from this link http://answers.yahoo.com/question/index?qid=20100927173625AAmEmiW Code: [Select] <?php // Get the name they entered in the form // We'll be naming the file this $file = $_POST['name']; // Get the email from the form $email = $_POST['email']; // We want the file to be a text file right? $ex = ".txt"; // Try to open a file named $file$ex (johndoe.txt for example) // Because this file doesn't exist yet the server creates it $write = fopen("$file$ex","w"); // Now open the file up again but this time save the email in it fwrite($write,$email); // MAKE SURE you close the file!!! fclose($write); // The folder that this script is in on the server is where the file we just made was saved // We can 'rename' it to another folder // The folder on the server we want to move it to $data = "../emails/"; // Now put it all together: This example goes out of the folder we're in and into the folder 'emails' // The new 'name' would be this now (../emails/johndoe.txt): So now the file is moved to where we want for storage rename ("$file","$data$file$ex"); // The script is done, send the user to another page (Just read the address below and you'll get it) exit; ?> unfortunately it doesn't do as i would like. I'm not sure how to get it to save a new file based on a variable on the form page or from one of the fields in the form. What i need is a way for a user to submit the form and it save the data into a uniquely named csv file. I know the code given is for text files, not csv, but that was about all i could find. If there is any help i would greatly appreciate it. Hello Everyone, Currently our form is not sending confirmation emails. We can see the quote requests in our content management system however are sales team is not getting the email requesting the quote. There is no option in our content management system to click this on or off so I am assuming something is not right in the code. form-process.php Code: [Select] <? session_start(); include('settings.php'); include('classes/class.formdata.php'); include('classes/class.email.php'); include('classes/class.DB.php'); include('functions/functions.general.php'); if ($_POST["PreviousOrderNumber"]){$_POST["Layout*"]=$_POST["PreviousOrderNumber"];} unset($_POST["PreviousOrderNumber"]); $newformdata = new FormData($_POST); //echo "Hello"; switch ($send_form_data) { case 'email': { if (!$_SESSION['formerrors']) { $newemail = new Email($to,$from, $subject); $newemail->SendEmail(); var_dump($_SESSION["formdata"]); unset($_SESSION["formdata"]); $redirect = $newformdata->referrer; header("Location: $redirect"); } } break; case 'email/db': { if (!$_SESSION['formerrors']) { $newemail = new Email($to,$from, $subject); $newemail->SendEmail(); $dbFormData = new DB(); $dbFormData->writePostToDB($_SESSION["formdata"],"QuoteRequests"); if (count($_FILES)>1){ $dbFormData->writeFilesToDB($_FILES,"QuoteRequests"); } unset($_SESSION["formdata"]); } } break; default: { echo 'Invalid setting in variable $send_form_data'; } break ; } //echo "END"; //exit; $redirect = $newformdata->referrer; header("Location: $redirect"); exit; $newformdata = new FormData($_POST); //var_dump($_SESSION['formerrors']) . " - " .var_dump($_SESSION["formdata"]);exit; switch ($send_form_data) { case 'email': { if (!$_SESSION['formerrors']) { $newemail = new Email($to,$from, $subject); $newemail->SendEmail(); unset($_SESSION["formdata"]); } } break ; default: { echo 'Invalid setting in variable $send_form_data'; } break ; } //insert into db if (!$_SESSION['formerrors']) { $arg = ''; $FirstName= $_POST['FirstName*']; $LastName= $_POST['LastName*']; $Company= $_POST['Company']; $Phone= $_POST['Phone*']; $Fax= $_POST['Fax']; $Email= $_POST['Email*']; $PONumber= $_POST['PONumber']; $Address= $_POST['Address*']; $ApartmentOrUnitNumber= $_POST['ApartmentOrUnitNumber']; $City= $_POST['City*']; $State= $_POST['State*']; $Zip= $_POST['Zip*']; $Quantity= $_POST['Quantity*']; $Height= $_POST['Height*']; $Width= $_POST['Width*']; $Characters= $_POST['Characters*']; $AdditionalCharacters= $_POST['AdditionalCharacters']; $Metal= $_POST['Metal*']; $Border= $_POST['Border*']; $Texture= $_POST['Texture*']; $Color= $_POST['Color*']; $Finish= $_POST['Finish*']; $Mounting= $_POST['Mounting*']; $Font= $_POST['Font*']; $Capitalization= $_POST['Capitalization*']; $Proof= $_POST['Proof*']; $Layout= $_POST['Layout*']; $Logo= $_POST['Logo']; $SpecialInstructions= $_POST['SpecialInstructions']; //echo "Done"; exit; $arg = "INSERT INTO `healypla_general`.`QuoteRequests` (`Quote_Id`, `FirstName`, `LastName`, `Company`, `Phone`, `Fax`, `Email`, `PONumber`, `Address`, `ApartmentOrUnitNumber`, `City`, `State`, `Zip`, `Quantity`, `Height`, `Width`, `Characters`, `AdditionalCharacters`, `Metal`, `Border`, `Texture`, `Color`, `Finish`, `Mounting`, `Font`, `Capitalization`, `Proof`, `Layout`, `Logo`, `SpecialInstructions`, `DateSubmitted`) VALUES (NULL, '$FirstName ', '$LastName', '$Company', '$Phone', '$Fax', '$Email', '$PONumber', '$Address', '$ApartmentOrUnitNumber', '$City', '$State', '$Zip', '$Quantity', '$Height', '$Width', '$Characters', '$AdditionalCharacters', '$Metal', '$Border', '$Texture', '$Color', '$Finish', '$Mounting', '$Font', '$Capitalization', '$Proof', '$Layout', '$Logo', '$SpecialInstructions', CURRENT_TIMESTAMP);"; $newdb = new DB($dbhost, $dbuser, $dbpass, $dbname); $arg = $arg; $result1 = $newdb->insert_db($arg); } $redirect = $newformdata->referrer; if ($_SESSION['formerrors']) { header("Location: $redirect"); } else { echo "Done";} exit; ?> $FirstName= $_POST['FirstName*']; $LastName= $_POST['LastName*']; $Company= $_POST['Company']; $Phone= $_POST['Phone*']; $Fax= $_POST['Fax']; $Email= $_POST['Email*']; $PONumber= $_POST['PONumber']; $Address= $_POST['Address*']; $City= $_POST['City*']; $State= $_POST['State*']; $Zip= $_POST['Zip*']; $Quantity= $_POST['Quantity*']; $Height= $_POST['Height*']; $Width= $_POST['Width*']; $Characters= $_POST['Characters*']; $AdditionalCharacters= $_POST['AdditionalCharacters']; $Metal= $_POST['Metal*']; $Border= $_POST['Border*']; $Texture= $_POST['Texture*']; $Color= $_POST['Color*']; $Finish= $_POST['Finish*']; $Mounting= $_POST['Mounting*']; $Font= $_POST['Font*']; $Capitalization= $_POST['Capitalization*']; $Proof= $_POST['Proof*']; $Layout= $_POST['Layout*']; $Logo= $_POST['Logo']; $SpecialInstructions= $_POST['SpecialInstructions']; then settings.php Code: [Select] <? //Global settings //Handles what to do with form data after it has been validated //email or database $send_form_data = 'email/db'; //Email settings //Where to send email $to = 'sales@healyplaques.com'; //Where it came from $from = 'quote'; //Subject of email $subject = 'Custom Plaque Quote - '; //Database settings ?> Any help would be extremely appreciated! Thanks, Amanda Smith Hi, am having abit of a problem.Can anyone help me in programming my form to send it's details to an email address.The form should be able to detect unfilled fields,unselected items all in all the form should work as a effectively according to how i designed it The email sending processing should be handled by a separate file known as process.php below is the HTML coding... <form name="myform" action="process.php" method="POST"> Name: <input type="text" name="Name" /><br /> Email: <input type="text" name="Email" /><br /> Select something from the list: <select name="Seasons"> <option value="Spring" selected="selected">Spring</option> <option value="Summer">Summer</option> <option value="Autumn">Autumn</option> <option value="Winter">Winter</option> </select><br /><br /> Choose one: <input type="radio" name="Country" value="USA" /> USA <input type="radio" name="Country" value="Canada" /> Canada <input type="radio" name="Country" value="Other" /> Other <br /> Choose the colors: <input type="checkbox" name="Colors[]" value="green" checked="checked" /> Green <input type="checkbox" name="Colors[]" value="yellow" /> Yellow <input type="checkbox" name="Colors[]" value="red" /> Red <input type="checkbox" name="Colors[]" value="gray" /> Gray <br /><br /> Comments:<br /> <textarea name="Comments" rows="10" cols="60">Enter your comments here</textarea><br /> <input type="submit" /> </form> HI, I am trying to use pagination on the record getting displayed into the table and there's restriction on record that at a time total 15 records can be displayed and others will be displayed by clicking on NEXT (on which i did the following coding). In my SQL query 'where' clause there is select * from db where status = $query Code: [Select] <?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?> <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>?id=<?php echo $yes;?>">Next</a> <?php } // Show if not last page ?> The problem that i am facing is when i click on next then the $query gets equal to null which results to showing no record into the table kindly help how can i modify the above code so the previous value present in $query doesn't get NULL by clicking on next and show next 15 records sucessfully??? NOTE: The main purpose of the above mentioned code is to show next 15 records (which works fine if $query != NULL). |