PHP - Obtaining Server Ip From Form Post
I have a website that a user fills out there login information which we then post to another website outside of our system. The website where the information is being posted is doing an IP check. They are trying to check for our server IPs instead of the users IPs. Since the POST is coming from the user, there is no way to get the server IP (that I know of...right?). As a work around for this, I'm trying to initially post to another script on our server which will then repost the information using PHP. This way the IP will be from our server instead of the user.
I've tried using curl, and while that allows me to pull the content of the webpage, it does not redirect the user to the page after the login. I've also tried using header() but I'm pretty sure that solution will not work either. So does anyone know how I can send post information to a website on my server using php and have it send the user to the resulting page? Thanks Similar TutorialsHey Guys. I am working with a form that shows the grand total on the checkout page. The value of the grand total is inside a hidden field. When click on submit, the _POST array doesn't get back the last value of the grand total. I need to hit the button twice to get the last value. The weird thing is when I echo the value of the grand total it display the latest value, but not with the POST array
For example. If the grand total is $10.00 and I click on submit. It will show the POST['grand_total'] as empty. If I click on submit again it will show the grand total of $10.00.
Below is my code that I am working with. Any help would be really appreciated.
if(isset($_POST['submit'])) { /* Doesn't show if i put it after if($_POST['submit'] */ if(isset($_POST['grand_total'])) { echo $_POST['grand_total']; } } //A bunch of other html/php code. Another class calculates the subtotal assigns it the variable $subtotal $cart_totals = new cartTotals($subtotal, $discounted_amount,$post_values->tip); // Cart class is shown below /* Doesn't show if i put it before if($_POST['submit'] */ if(isset($_POST['grand_total'])) { echo $_POST['grand_total']; } echo "<input name='grand_total' type='hidden' value='$cart_totals->grand_total' />"; // Shows the grand total after second from submission echo "$cart_totals->grand_total"; // Shows grand total after the first submissionCart Totals Class class cartTotals { public $subtotal; public $sales_tax; public $tip; public $grand_total; public $discount_amount; public $href_page; public $invalidCouponMessage; const TEST_ENVIORMENT = FALSE; /** * [ Function gets constructed in the order summary where the [$discount_amount= ""] arg does need to be passed. * But does get passed in when called on the checkout.php page. Therefore we set the default value to an empty string.] * @param [float] $subtotal [subtotal get passed in from the parent class coreCartFunction] * @param string $discount_amount [The class checkCouponCode calculates this discount amount based on the * subtotal and the discount amount. It gets instantiated on the clients side and passed is this construction function. * This is all done on the checkout page.] */ /*The way the construct function works is by invoking all the methods the passed arguments When the methods get invoked the do all the work and set the properties its values. The properties then get echoed out on the client side. */ function __construct($subtotal="", $discount_amount= "", $tip=""){ $this->subTotal($subtotal, $discount_amount);//SubTotal method takes the discount amount and subtracts it from the subtotal. $this->salesTax($subtotal, $discount_amount); $this->tip = $tip; $this->grandTotal(); } private function subTotal($subtotal,$discount_amount) { $rounded_subtotal = round($subtotal-$discount_amount,2); $money_format_subtotal = money_format('%i',$rounded_subtotal); $this->subtotal = $money_format_subtotal; } private function salesTax($subtotal, $discount_amount =""){ $sales_tax = (STORE_SALES_TAX)?(float)STORE_SALES_TAX:8.875; $sales_tax =(($this->subtotal)*$sales_tax)/100; $sales_tax = round($sales_tax,2); $this->sales_tax = $sales_tax; } public function Tip() { //global $post_values; //$last_tip_selected = $post_values->tip > 0 ? $post_values->tip : "" ; $tip_output = "<select id='tip' name='tip'>"; for($tip=0.00; $tip<=11.75; $tip+=0.25){ if( $tip == "2") {$selected = " selected";} else {$selected ="";} $formatted_tip = money_format('%i',$tip); $tip_output .= "<option {$selected} id='selected_tip' value='$formatted_tip'>"."$".$formatted_tip ."</option>".PHP_EOL; } $tip_output .= "</select>"; return $tip_output; } private function grandTotal(){ $grand_total = round($this->sales_tax+$this->subtotal+$this->tip,2); $grand_total_formatted = money_format('%i',$grand_total); $this->grand_total = $grand_total_formatted; } I need to make my client's site distinguish among different tabs in the same browser. (See http://www.phpfreaks.com/forums/index.php?topic=357772.0 for background.) I create a tab ID when the user first visits the site in a particular tab, and I'm passing it from page to page as a parameter. This seems to be the only way to do what I need. The tab ID is always passed through POST so that the user won't see it. If it were visible, users could make trouble (or more likely get in trouble) by adding or removing the ID themselves. This is not simple where a page is loaded by a hyperlink. The anchor tag passes parameters via GET, period. The solution I found is to link to a script named post.php, which takes the real link target and the tab ID as parameters, sends the browser a form that passes the tab ID to the real link target via POST, and auto-submits the form via JavaScript. This works, but it requires two round trips to the browser to load a page. It's also a pain to code. Is there a more efficient way to do this... perhaps a way to make the server send the browser a POST response, even though it made a GET request? If it matters, the server is Apache 2.x. Hi guys, I am searching for the definitive way of obtaining the root directory of my app. I need to it to work on localhost and also on ALL platforms, NIX, Windows etc. I would like to do this as I wish to use it to locate all my sub directory files - includes, model etc. For example, I may have this as my landing page: http://www.mywebsite.com/index.php The root directory might be: html The index.php might reside he html/index.php ... but my includes files might be he html/lib/includes So I would be looking to obtain the root in an absolute kind of way to allow me to string together the includes sub directory in a relative kind of way. In summary then: 1. How to obtain the root with 100% percent success, all of the time on all platforms. 2. How to string the sub directory together with 100% percent success, all of the time on all platforms. 3. Any comments on this as an approach, also welcome. Many thanks in advance, S This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=347360.0 Hi all, not sure if this belongs in the Javascript section or PHP... I have a 3 pages, Index.php, a Javascript file and my display.php page. My Index page has a list of inputs which populate the variables in my javascript file when exectued, the javascript file then uses these variables to perform simple mathematical calculations and then displays the data using the innerHTML function back on my index page. From the index page I need to then post all my values, including these in the innerHTML div's as a POST array to my display.php only im unsure where to start. Hopefully thaat makes sense, would anybody have any idea on how to do this? Thanks How can i make a send POST FORM from this api: http://pub.tapulous.com/tapplications/coresocial/v1/chat/api/index.php?method=message_send&session={"device_id":+"03decef7aad6fb64fb5c5ed3f1d35a3d16413e490a2874",+"room":+"Songs%253AExtreme"}&message= message here Thanks people why doesn't this work? Code: [Select] <form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post"> <input type="text" id="name" name="name" size="20" /></p> <input type="submit" name="submit" value="Submit" alt="Submit" /> </form> <? if($name != "") { $xml = simplexml_load_file("invoice.xml"); $sxe = new SimpleXMLElement($xml->asXML()); $itemsNode = $sxe->data[0]; $main = $itemsNode->addChild(inv); $sub = $main->addChild("name", $name); $sxe->asXML("invoice.xml"); } ?> The existing xml file looks like this: Code: [Select] <?xml version="1.0" encoding="utf-8"?> <root> <data> <inv> <name>Sally Prince</name> </inv> </data> </root> And, my intention is is I fill out the form with "Bill Gates" the xml will become: Code: [Select] <?xml version="1.0" encoding="utf-8"?> <root> <data> <inv> <name>Sally Prince</name> </inv> <inv> <name>Bill Gates</name> </inv> </data> </root> Also if I just set Code: [Select] $name = "Bill Gates" it works.. but the form will not pass the data to the xml.. what am I missing? Thanks! Ok so I've got trouble with a form I'm creating, I've got this: <form id="login" name="login" action="URL" method="post"> and then Input fields like: <input tabindex="3" type="text" class="login-field" name="acc.username" id="login-username" value="" maxlength="48"/> Now, if I go and submit that, and on the "URL" page I've had it echo $_POST['acc.username'] but it doesn't echo anything. I think it may be a problem with the form itself.. although I can't see one. The code I got for URL: <?PHP include('global.php'); if(isset($_POST['acc.username'])) { echo "lol"; } else { echo mysql_error(); } ?> In my invoice system im trying to carry information from 1 page to another, witch i have been successful with, now I am trying to alter table rows on my data tables I need to send the same account number and invoice number, how can i achieve this without putting the account number and invoice number inside a form element? Hi, I am having a problem with my form. It posts fine on Firefox 3.6 on my MAC, but not on Safari 5 on my MAC. It also does not work Internet Explorer 9, Firefox 4 or Google Chrome on a windows box. Basically it posts back to itself, no email is sent and it does not hit my sql database. Here is the pertinent code to my index.html file... Code: [Select] <script type="text/javascript"> function showMonth(str) { if (str=="") { document.getElementById("txtHint").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","reserv.php?q="+str,true); xmlhttp.send(); } </script> <form method="post" action="resersend.php"> <p><font face="arial" size="2" color="#336600">Reservation month:</font> <select name="months" onchange="showMonth(this.value)"> <option value="" selected="selected">Choose One</option> <option value="May 2011">May 2011</option> <option value="June 2011">June 2011</option> <option value="July 2011">July 2011</option> <option value="August 2011">August 2011</option> <option value="September 2011">September 2011</option> <option value="October 2011">October 2011</option> <option value="November 2011">November 2011</option> <option value="December 2011">December 2011</option> <option value="January 2012">January 2012</option> <option value="February 2012">February 2012</option> <option value="March 2012">March 2012</option> <option value="April 2012">April 2012</option> </select> </form></p> Here is the reserv.php file (code) that works with the html file.... Code: [Select] <?php $q=$_GET["q"]; $con = mysql_connect('my_host', 'my_user', 'my_pwd'); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("my_db", $con); $sql="SELECT * FROM daterange WHERE DEND > DATE(NOW()) AND STATUS='A' AND MONTH = '".$q."' ORDER BY RID, DATE, SITE"; $result = mysql_query($sql); // Determine the number of reservation dates $number = mysql_numrows($result); // Create drop-down menu of reservation dates print "<font size=\"3\" face=\"Arial\"><b>Select Your Reservation:</b><br> <form action=\"resersend.php\" method=\"post\"> <select name=\"RID\"> <option value=\"\">Choose One</option>"; for ($i=0; $i<$number; $i++) { $RID = mysql_result($result,$i,"RID"); $DATE = mysql_result($result,$i,"DATE"); $SITE = mysql_result($result,$i, "SITE"); $PRICE = mysql_result($result,$i, "PRICE"); print "<option value=\"$RID\">$DATE, $SITE, $PRICE</option>"; } print "</select><p align=left><label><font size=\"3\" face=\"Arial\">First Name: <input type=\"text\" name=\"FNAME\" size=\"50\" maxlength=\"50\" tabindex=\"1\"<br>"; print "<p align=left><label>Last Name: <input type=\"text\" name=\"LNAME\" size=\"50\" maxlength=\"50\" tabindex=\"2\"<br>"; print "<p align=left><label>Address Line 1: <input type=\"text\" name=\"ADDR1\" size=\"50\" maxlength=\"50\" tabindex=\"3\"<br>"; print "<p align=left><label>Address Line 2: <input type=\"text\" name=\"ADDR2\" size=\"50\" maxlength=\"50\" tabindex=\"4\"<br>"; print "<p align=left><label>City: <input type=\"text\" name=\"CITY\" size=\"50\" maxlength=\"50\" tabindex=\"5\"<br>"; print "<p align=left><label>State (abbrev.): <input type=\"text\" name=\"STATE\" size=\"2\" maxlength=\"2\" tabindex=\"6\"<br>"; print "<p align=left><label>Zip Code: <input type=\"text\" name=\"ZIP\" size=\"5\" maxlength=\"5\" tabindex=\"7\"<br>"; print "<p align=left><label>Contact Phone Number: (<input type=\"text\" name=\"PHONE1\" size=\"3\" maxlength=\"3\" tabindex=\"8\""; print "<label>)<input type=\"text\" name=\"PHONE2\" size=\"3\" maxlength=\"3\" tabindex=\"9\""; print "<label>-<input type=\"text\" name=\"PHONE3\" size=\"4\" maxlength=\"4\" tabindex=\"10\"<br>"; print "<p align=left><label>Email: <input type=\"text\" name=\"EMAIL\" size=\"50\" maxlength=\"50\" tabindex=\"11\"<br>"; print "<p align=left><input type=\"submit\" value=\"Book Now!\" name=\"submit\">"; print "<input type=\"reset\" value=\"reset\" name=\"reset\"></form>"; // Close the database connection mysql_close($con); ?> Anyone have any ideas? I suspect it may have to do with the javascript in the index.html file, but I can't nail it down. Thanks. I am trying to get this form to submit, but it doesn't go anywhere. I checked the browser console and I see "Failed to load resource: the server responded with a status of 500 (Internal Server Error)". Can someone help me resolve this error?
CODE: <html> <head> <title>PICK 5 :: 13 Ticket System (3 of 5 WHEEL)</title> <style> .wrap{ text-align:center; width:900px; margin: 0 auto; } .row{ margin: 18px 0; } .input{ border:1px solid #ccc; width:800px; float:left; margin:10px; } .output{ width:700px; margin:0 auto; text-align:left; } .output .str{ } .output .number{ font-weight:bold; margin-right:5px; } .clear{ clear:both; } </style> </head> <body bgcolor="#F5F5F5"> <div class="wrap"> <form method="post" action=""> <div class="row"><p><span style="font-weight: bold; color: #0000FF;">PICK 5 :: 13 Ticket System (3 of 5 WHEEL)</span></p> <p>(Guaranteed <span style="font-weight: bold; color: #0080ff;">3-WIN</span>, if 5 of the numbers drawn are in your set of 15 numbers)</p> <label>Please enter 15 numbers and separate them with a comma ","<br></label> <input type="text" name="num" value="<?= isset($_POST['num'])?$_POST['num']:'1,2,3,4,5,6,7,8,9,10,11,12,13,14,15' ?>" /> </div> <div class="row"><input type="submit" name="submit" value="Go" /> </div><br> <?php if(isset($_POST['submit'])){ $num = $_POST['num']; $num_array = explode(',',$num); $alpha_array = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O'); $array1 = array(); for($i=0; $i<15; $i++) { $array1[$alpha_array[$i]] = trim($num_array[$i]); } $array2 = array( array('A', 'B', 'C', 'L', 'M'), // Start 15# (3if5 Wheel) - 13 Lines array('A', 'B', 'D', 'H', 'I'), // Where .. (A1, B2, C3, D4, E5, F6, G7, H8, I9, J10, K11, L12, M13, N14, O15) array('A', 'C', 'G', 'H', 'O'), array('A', 'E', 'K', 'N', 'O'), array('A', 'F', 'G', 'J', 'L'), // LINE 5 array('B', 'D', 'F', 'L', 'O'), array('B', 'E', 'F', 'G', 'I'), array('B', 'H', 'J', 'K', 'N'), array('C', 'D', 'E', 'F', 'J'), array('C', 'I', 'K', 'L', 'N'), // LINE 10 array('D', 'G', 'K', 'M', 'N'), array('E', 'F', 'H', 'L', 'M'), array('F', 'I', 'J', 'M', 'O'), // LINE 13 ); $data = ""; foreach($array2 as $arr){ $data1 = ""; foreach($arr as $a){ $data1 .= $array1[$a] . ', '; } $data[] = rtrim($data1,', '); } ?> <div class="output"> <?php foreach($data as $k=>$v){ echo '<span class="number">'.($k+1) . '.</span><span class="str">' . $v . '</span><br>'; } } ?> </div> <div class="clear"></div> </form> </div> </body> </html> Edited February 25, 2019 by requinix please use the Code <> button when posting code. Please help me. I tried to make a form from my database, and calculate the product of values which was selected. Code: [Select] <?php $dbconn = pg_connect('host=localhost port=5432 dbname=test user=test password=test'); if(!$dbconn) { exit('DB Connect Failed!'); } $result = pg_query( $dbconn, " SELECT * FROM record " ); if(!$result){ exit('SELECT Failed!!!'); } $rows = pg_fetch_all($result); ?> <html><body> <form name="cal" method="post" action="cal2.php"> <?php if(!$rows): ?> <div>No data was found.</div> <?php else: ?> <table> <tr> <th class="ass">object name</th> <th class="ass" colspan="3">price</th> </tr> <?php foreach($rows as $r): ?> <tr> <td><?php echo $r['object_name']; ?></td> </td> <td> <input type="radio" name="<?php echo $r['object_name'] ?>" value="<?php echo $r['price_1'] ?>"> <?php echo $r['object_1'] ?></td> <td> <input type="radio" name="<?php echo $r['object_name'] ?>" value="<?php echo $r['price_2'] ?>"> <?php echo $r['object_2'] ?></td> <td> <input type="radio" name="<?php echo $r['object_name'] ?>" value="<?php echo $r['price_3'] ?>"> <?php echo $r['object_3'] ?></td> </tr> <?php endforeach; ?> </table> <?php endif; ?> <input type="submit" name="submit" value="SUBMIT"> <input type="reset" value="CLEAR"> <br><br> </form> I can get values from selected object, but I don't know how to calculate their total product. Code: [Select] <?php foreach ( $_POST as $key => $val ) { $selval = "$val, "; echo $selval; } //echo values from selected objects. ex. 12, 15, 13.... //then, product each values. ex. 12*15*13... $p = 1; foreach ( $_POST as $key => $val ) { $p *= $val; echo $p; } //it didn't work foreach ( $_POST as $key => $val ) { $a = array($val); echo array_product($a); } //it didn't work ?> Ok so I already have a "post" action URL, here it is below. <form method="post" action="http://survey.leisuretrends.com/RemoteSurvey.asp?survey=321&survey_version=1330"> The idea is to put a simple e-mail form on my personal website: And have the post action to go to the URL above (its a marketing company for email submissions / newsletters) Here is what I have so far, but I know something is not right: Quote <form> <input type="text" /> <input type="submit" /> <form method="post" /> <form action="http://survey.leisuretrends.com/RemoteSurvey.asp?survey=321&survey_version=1330"/> </form> Any help would be greatly appreciated. Thank you for your patience with me Hi all, I have a page with 4 textboxes which can be filled out. The thing is I want people to be able to only train 1 type at a time. Underneath I posted the Form page and the exec page does anyone have and idea?? Thnx Ryflex FORM: <?php //authentication & database configuration require_once('auth.php'); require_once('config.php'); //member_ID and city_ID and greyed out empty declaration $member_ID = $_SESSION['SESS_MEMBER_ID']; $city_ID = $_SESSION['SESS_CITY_ID']; $ro = ""; //Database connection $global_dbh = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die("Could not connect to database"); mysql_select_db(DB_DATABASE, $global_dbh) or die("Could not select database"); //get infantry units type = 1 $sql = "SELECT name, resource_1, resource_2, resource_3, timestamp FROM unittype WHERE type = 1"; $result = mysql_query($sql) or die("Could not find units"); //get the 4 unit types in the $n[] array while($data = mysql_fetch_assoc($result)) { $one[] = $data[resource_1]; $two[] = $data[resource_2]; $three[] = $data[resource_3]; $time[] = $data[timestamp]; } //query amount of infantry troops $sql = "SELECT * FROM infantry WHERE member_id = '$member_ID'"; $result = mysql_query($sql) or die("Could not find amount of troops"); //get amount of infantry troops while($data = mysql_fetch_assoc($result)) { $n[] = $data[name]; $training[] = $data[training]; $timestamp[] = $data[timestamp]; $amount[] = $data[amount]; } //check if a training is underway $sql = "SELECT * FROM infantry WHERE member_id = '$member_ID' AND training = 1"; $trcurr = mysql_fetch_array( mysql_query($sql)); if($trcurr['training'] == 1) { $ro = "READONLY STYLE='color:#999999;background:#DEDEDE'"; } ?> <html> <head> <title>Infantry Training</title> <link href="loginmodule.css" rel="stylesheet" type="text/css" /> </head> <body> <p>You can only train 1 type of infantry at a time.</p> <form id="create" name="create" method="POST" action="infantry_exec.php"> <table> <tr> <td><b><?php echo $n[0]; ?></b></td> <td><b><input name="<?php echo $n[0]; ?>" type="text" <?php echo $ro; ?> maxlength="10" id="<?php echo $n[0]; ?>" /></b></td> </tr> <tr> <td><b><?php echo $n[1]; ?></b></td> <td><b><input name="<?php echo $n[1]; ?>" type="text" <?php echo $ro; ?> maxlength="10" id="<?php echo $n[1]; ?>" /></b></td> </tr> <tr> <td><b><?php echo $n[2]; ?></b></td> <td><b><input name="<?php echo $n[2]; ?>" type="text" <?php echo $ro; ?> maxlength="10" id="<?php echo $n[2]; ?>" /></b></td> </tr> <tr> <td><b><?php echo $n[3]; ?></b></td> <td><b><input name="<?php echo $n[3]; ?>" type="text" <?php echo $ro; ?> maxlength="10" id="<?php echo $n[3]; ?>" /></b></td> </tr> <tr> <td colspan="2"><center><input type="submit" name="Submit" value="Train!!!" /></center></td> </tr> </table> </form> </body> </html> EXEC: <?php //authentication & database configuration require_once('auth.php'); require_once('config.php'); //member_ID and city_ID $member_ID = $_SESSION['SESS_MEMBER_ID']; $city_ID = $_SESSION['SESS_CITY_ID']; //Database connection $global_dbh = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die("Could not connect to database"); mysql_select_db(DB_DATABASE, $global_dbh) or die("Could not select database"); //query names of infantry troops $sql = "SELECT * FROM infantry WHERE member_id = '$member_ID'"; $result = mysql_query($sql) or die("Could not find amount of troops"); //get names of infantry troops while($data = mysql_fetch_assoc($result)) { $n[] = $data[name]; } //convert POST to normal variable $amount = array(0 => $_POST[$n[0]], 1 => $_POST[$n[1]], 2 => $_POST[$n[2]], 3 => $_POST[$n[3]]); ?> Hi all, Hoping someone can help with what i would guess is a very simple problem. I have the following code which is suppose to display a form. the form posts to itself and uses isset and if the form has been posted it doesnt display the form. if (isset($_POST['submit'])) { echo "question submitted successfully"; } else { echo '<form method="post" name="qanda" id="qanda" action="http://' . $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"] . '">'; echo '<p><label for="name">Name</label> <input type="text" id="name" /></p>'; echo '<p><label for="e-mail">E-mail</label> <input type="text" id="e-mail" /></p>'; echo '<p><label for="Question">Question</label> <textarea rows="6" id="question"></textarea></p>'; echo '<p class="submit"><input type="submit" value="Submit" /></p></form>'; } this currently doesnt work. Extra things you might need to know is that this script/form is an included file in a dynamic site which also uses the rewrite module which is why I am using http://' . $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"] just incase that makes a difference. Hello! Hi I am really getting with validating a drop down box in my form for posting I have set all the <options> in html form as followed: <form method="post" action="thankyou.php"> <?php $ipi = getenv("REMOTE_ADDR"); $httprefi = getenv ("HTTP_REFERER"); $httpagenti = getenv ("HTTP_USER_AGENT"); ?> <input type="hidden" name="ip" value="<?php echo $ipi ?>" /> <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" /> <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" /> <select name="visitortitle"> <option>Please Select</option> <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> </select> </form> now I'm trying to find a way to validate it in the .php sending side and using this: <?php $visitortitle = $_POST['visitortitle']; if (!isset($visitortitle)) { echo $visitortitle; } mail("email@domain.com", $subject, $message, $from); ?> I have tried so many different ways with - if (!isset - but cant get the send mail to recognise the drop down menu selection!!!! Any help would really be appreciated as I'm not that up on php coding. Thanks in advance. Gary I have created a Post php form, It send two emails, One email to the user after they submit the form and other to me. Now the users will fill up the form in arabic and a confirmation email will be sent to them in arabic also...I tested my form, I get the confirmation email in arabic, its fine, but the data tht the user inputs in arabic on the form comes to my email with strange characters.....i want to receive the data entered by user in arabic. Below is the HTML and Php Here is my HTML Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="ar" xml:lang="ar" xmlns="http://www.w3.org/1999/xhtml"> <head> <link href="../../css/cssfinal.css" type="text/css" rel="stylesheet"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Language" content="ar"> <title>Untitled Document</title> <style type="text/css"> <!-- body { background-color: #FFFFFF; } .style8 {color: #FF0000} --> </style> <script src="../../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script> <script src="../../SpryAssets/SpryValidationSelect.js" type="text/javascript"></script> <link href="../../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" /> <link href="../../SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css" /> </head> <body> <table align="center" width="547" border="0" cellpadding="0" cellspacing="0"> <tr> <td> </td> </tr> <tr> <td> </td> </tr> </table> <form method="post" name="enquiry" action="sendmailsqlar.php"> <table width="547" align="center" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="101" background="../../images/formhead.png"><div align="center" class="status" style="margin-bottom:20px; margin-top:20px">نموذج الاستفسار عن الدورة الأكاديمية</div></td> </tr> </table> <table width="547" border="0" align="center" cellspacing="0" cellpadding="0"> <tr> <td width="275"><div align="right"><input name="Name" type="text" id="visitor" value="" size="36" class="field" /></div></td> <td width="272" align="right"><div style="margin-left:25px; margin-bottom:10px; margin-top:10px; font-size:18px;"> <div style="margin-right:25px;">الاسم</div> <span id="sprytextfield1"><span class="textfieldRequiredMsg">مطلوب</span></span></div></td> </tr> <tr> <td><div align="right"><input name="Email" type="text" id="visitormail" size="36" class="field" /></div></td> <td align="right"><div style="margin-left:25px; margin-bottom:10px; margin-top:10px; font-size:18px;"> <div style="margin-right:25px;">البريد الإلكتروني</div> <span id="sprytextfield2"><span class="textfieldRequiredMsg">مطلوب</span><span class="textfieldInvalidFormatMsg">غير صحيح </span></span></div></td> </tr> <tr> <td><div align="right"><input name="Nationality" type="text" id="nationality" size="36" class="field" /></div></td> <td align="right"><div style="margin-left:25px; margin-bottom:10px; margin-top:10px; font-size:18px;"> <div style="margin-right:25px;">الجنسية</div> <span id="sprytextfield2"><span class="textfieldRequiredMsg">مطلوب</span></span></div></td> </tr> <tr> <td align=""><div align="right"> <select name="Level" id="stulevel" size="1" class="select"> <option value=""><span class="drop.Text">(إختر)</span></option> <option value=" Foundation/Diploma ">دبلوم</option> <option value=" Bachelor Degree ">البكالوريوس</option> <option value=" Master Degree ">ماجستير</option> <option value=" PhD./Others ">دكتوراه</option> </select> </span></div></td> <td align="right"><div style="margin-left:25px; margin-bottom:10px; margin-top:10px; font-size:18px;"> <div style="margin-right:25px;">المرحلة الدراسية المطلوبه</div> <span id="spryselect1"><span class="selectRequiredMsg">مطلوب</span></span></div></td> </tr> <tr> <td><div align="right"><input name="Field" type="text" id="stfield" size="36" class="field" /></div> </td> <td align="right"><div style="margin-left:25px; margin-bottom:10px; margin-top:10px; font-size:18px;"> <div style="margin-right:25px;">مجال الدراسة \ التخصص</div> <span id="sprytextfield3"><span class="textfieldRequiredMsg">مطلوب</span></span></div></td> </tr> <tr> <td colspan="2"><table width="547" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="275"><label> <div align="right"><textarea name="Message" style="background-color:#ccc2b2" class="field" id="message" cols="27" rows="6"></textarea></div> </label></td> <td width="272" align="right"><div style="margin-left:25px; margin-bottom:10px; margin-top:10px; font-size:18px;"> <div style="margin-right:25px;">ملاحظات</div> </div></td> </tr> </table></td> </tr> <tr> <td colspan="2" height="101" background="../../images/formfoot.png"><div align="center" style="margin-top:15px"> <input type="submit" class="btn1" value="إرسال" /> </div></td> </tr> </table> </form> <script type="text/javascript"> <!-- var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1"); var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "email"); var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3"); var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1"); var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4"); //--> </script> </body> </html> Here is the PHP Code: [Select] <html dir="rtl"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="ar"> </head> <?php $to = "xx@xxx.com"; $visitor = $_REQUEST['Name'] ; $visitormail = $_REQUEST['Email'] ; $nationality = $_REQUEST['Nationality'] ; $stulevel = $_REQUEST['Level'] ; $stfield = $_REQUEST['Field'] ; $message = $_REQUEST['Message'] ; $header = "From: $visitormail\n" . "Reply-To: $visitormail\n"; $subject = "Arab Enquiry"; $message = "From: $visitor \n\n Email: $visitormail \n\n Nationality: $nationality \n\n Level: $stulevel \n\n Field: $stfield \n\n Message: $message"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; mail($to, $subject, $message, $header); //Sending auto respond Email to visitor $reply_header = "From: ttt@ttt.com\n" . "Reply-To: vvv@vvv.com\n"; $reply_subject = " - تم استلام طلبكم"; $reply_to = "$visitormail"; $reply_message = "$visitor \n\n شكرا لزيارتكم موقعنا . \n نود ابلاغكم بأنه تم استلام طلبكم وسوف يتم الرد عليكم قريبا.\n هذه الرسالة مرسلة من نظام الموقع.\n شكرا\n ."; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; mail($reply_to, $reply_subject, $reply_message, $reply_header); header("Location: thankyouar.html"); ?> please help !!!! i would appreciate |