PHP - Yet Another Extremely Simple Problem...
Can someone explain to me whats wrong with this?
<?php session_start(); // store session data $_SESSION['views']=1; ?> <html> <body> <?php //retrieve session data echo "Pageviews=". $_SESSION['views']; ?> </body> </html> The output it gives me in the browser is this: Quote Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:\Program Files\xampp\xampp\htdocs\sessions.php:1) in D:\Program Files\xampp\xampp\htdocs\sessions.php on line 2 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\Program Files\xampp\xampp\htdocs\sessions.php:1) in D:\Program Files\xampp\xampp\htdocs\sessions.php on line 2 Pageviews=1 Explanation? Similar TutorialsHello all, I finally started learning php and with the little knowledge I have from CPP it's far simpler than it seemed years ago. I need a little bit of help with this function I followed in a tutorial and it's just not working. <?php function writeName($fname) { echo $fname . " Refsnes.<br />"; } echo "My name is "; writeName("Kai Jim"); echo "My sister's name is "; writeName("Hege"); echo "My brother's name is "; writeName("Stale"); ?> It just gives me a blank screen. Now, I figured #fname isnt set, so I did this: <?php $fname = "Refsnes"; function writeName($fname) { echo $fname . " Refsnes.<br />"; } echo "My name is "; writeName("Kai Jim"); echo "My sister's name is "; writeName("Hege"); echo "My brother's name is "; writeName("Stale"); ?> Still, no go, which leads me to think I'm probably mistaking. Help? I don't want to skip out things in a tutorial. Hi all. What am I doing wrong here? I cannot read from the file with fopen, this is the code. <html> <body> <?php $file=fopen("welcome.txt","r"); ?> </body> </html> I get a blank page, although I have text written in that file. Whenever I set it to "w" it still shows nothing - when I check the file manually with notepad, I see that it's blanked - but I think thats meant to happen, after all "w" clears the file. Have I understood correctly? This still shows a blank page, but it says it can't find the file if it's not in the directory - how it should be. <html> <body> <?php $file=fopen("welcome2123.txt","r") or exit("Unable to open file!"); ?> </body> </html> tl;dr - Why doesn't fopen read anything from the txt file? Encodings match - everything is in UTF-8, although I doubt thats the problem... Help? Okay, I have no idea how this works out but this is really getting on my nerves. Here is my logic for the following code. I manually register a user, It goes into the database and dispatches an email notification explaining that a user must activate their account and change their user name (OPTIONAL) and password. In the email, There is an automatically generated password with the username, And a link to activate the account. This leads to stage 1 of the activation process, In this stage the user is accepted, Registered as a verified user and then is sent to another page to change the details like login and password. As far as I know this page works except through trial and error I found that this little snippet of code is causing browsers to show an error 500 page, If I remove this the page works: <?php if($messages){ displayErrors($messages); } else { echo("<p align=\"center\" class=\"standard\">Your account has been activated.</p><p align=\"center\" class=\"standard\">You now need to change your password. If you like you can also change your username, Remember that you only have 3 days to do so and this change will be permanent.</p>"); } ?> and this is the displayErrors function: <?php function displayErrors($messages) { print("<p align=\"center\" class=\"standard\">"."<b>There were problems with the previous action:</b>\n<ul>\n"); foreach($messages as $msg){ print("<li>$msg</li>\n"); } print("</ul>\n"."</p>"); } ?> The displayErrors function is in a file called functions.php, Which is included in config.php, Which is included in every page including this one. The entire "Change password and login page thingie" is he <?php include("config.php"); global $link, $messages; require_once('recaptchalib.php'); if($_GET['error']){ $id=$_GET['id']; $messages[]="There is more than one or no accounts with the verification code you are using. <a href=\"mailto:rentals@nivso.co.uk?subject=Two or no accounts with activation ID of $id\">Click here to email us about this and have the problem sorted.</a>"; doIndex(); exit; } if(isset($_POST['submit'])){ if(!isset($_POST['activationid'])){ die("Doesn't exist -.- might as well quit this is *STUFF* -.-"); } $privatekey = "YOUR NOT HAVING THIS"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { $messages[]="The code you entered is incorrect. Please go back and try again!"; doIndex(); exit; // exit or the below lines will be processed. } else { //This is where the fun starts! $login=$_POST['login']; $passw=$_POST['password']; $passc=$_POST['passwordc']; $id2=$_POST['activationid']; $changinglogin=false; $get1=excDB("SELECT * FROM `users` WHERE `activeID`='$id2'"); if($get1[0]){ $get1=$get1[1]; } else { die($get1[2]); } $pro1=mysql_fetch_array($get1); if($pro1['login']!=$login){ $changinglogin=true; field_validator("Login", $login, "alphanumeric", 4, 15); } field_validator("Password", $passw, "string", 6, 20); if($passw!=$passc){ $messages[]="The passwords do not match, Please make sure that the passwords are the same!"; } if($messages){ doIndex(); exit; } $passcl=mysql_escape_string($passw); $passen=md5($passcl); if($changinglogin){ $wri1=excDB("UPDATE `users` SET `login`='$login', `password`='$passen', `passchange`='1', `loginchange`='1' WHERE `activeID`='$id2';"); if($wri1[0]){ $wri1=$wri1[1]; } else { die($wri1[2]); } header("Location: login.php?created"); } else { $wri1=excDB("UPDATE `users` SET `password`='$passen', `passchange`='1', `loginchange`='0' WHERE `activeID`='$id2';"); if($wri1[0]){ $wri1=$wri1[1]; } else { die($wri1[2]); } header("Location: login.php?created2"); } } } else { doIndex(); } function doIndex(){ ?> <!DOCTYPE html> <head> <title>Family Rental System! - Rent your DVDs here - Design by Alex, Coding by Gergy008</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link type="text/css" href="css/main.css" rel="stylesheet"> <style type="text/css"> <!-- body { background-color: #333333; } --> </style></head> <body style="text-align:center;"> <div class="first"> <div class="backgrounder1"></div> <div class="headerbar1"></div> <div class="headerbar2"></div> </div> <div align="center"> <table border="0" cellpadding="0" cellspacing="0" width="900"> <tr> <td><img src="images/spacer.gif" width="52" height="1" border="0" alt="" /></td> <td><img src="images/spacer.gif" width="123" height="1" border="0" alt="" /></td> <td><img src="images/spacer.gif" width="352" height="1" border="0" alt="" /></td> <td><img src="images/spacer.gif" width="33" height="1" border="0" alt="" /></td> <td><img src="images/spacer.gif" width="55" height="1" border="0" alt="" /></td> <td><img src="images/spacer.gif" width="110" height="1" border="0" alt="" /></td> <td><img src="images/spacer.gif" width="110" height="1" border="0" alt="" /></td> <td><img src="images/spacer.gif" width="50" height="1" border="0" alt="" /></td> <td><img src="images/spacer.gif" width="15" height="1" border="0" alt="" /></td> <td><img src="images/spacer.gif" width="1" height="1" border="0" alt="" /></td> </tr> <tr> <td colspan="9" background="images/template.slice.1.png"> </td> <td><img src="images/spacer.gif" width="1" height="20" border="0" alt="" /></td> </tr> <tr> <td colspan="5" background="images/template.slice.2.png"> </td> <td colspan="2" rowspan="2" background="images/template.slice.3.png"><span class="login"><?php echo(loginHandler()); ?></span></td> <td colspan="2" rowspan="3" background="images/template.slice.4.png"> </td> <td><img src="images/spacer.gif" width="1" height="30" border="0" alt="" /></td> </tr> <tr> <td rowspan="8" background="images/template.slice.5.png"> </td> <td colspan="2" background="images/template.slice.6.png"><form> <div align="center"> <input name="textfield" type="text" id="textfield" size="40" style="height:16px;"> <input type="submit" name="button" id="button" value="Search" style="height:20px;"> </div> </form></td> <td colspan="2" rowspan="2" background="images/template.slice.7.png"> </td> <td><img src="images/spacer.gif" width="1" height="30" border="0" alt="" /></td> </tr> <tr> <td colspan="2" rowspan="3" background="images/template.slice.8.png"><p> </p> <p> </p></td> <td colspan="2" background="images/template.slice.9.png"> </td> <td><img src="images/spacer.gif" width="1" height="70" border="0" alt="" /></td> </tr> <tr> <td rowspan="2" background="images/template.slice.10.png"> </td> <td colspan="4" background="images/template.slice.11.png"> </td> <td rowspan="6" background="images/template.slice.12.png"> </td> <td><img src="images/spacer.gif" width="1" height="30" border="0" alt="" /></td> </tr> <tr> <td colspan="4" background="images/template.slice.13.png"></td> <td><img src="images/spacer.gif" width="1" height="8" border="0" alt="" /></td> </tr> <tr> <td rowspan="4" background="images/template.slice.14.png"> </td> <td colspan="4" background="images/template.slice.15.png"> </td> <td colspan="2" rowspan="4" background="images/template.slice.16.png"> </td> <td><img src="images/spacer.gif" width="1" height="35" border="0" alt="" /></td> </tr> <tr> <td colspan="4" background="images/template.slice.17.png"> </td> <td><img src="images/spacer.gif" width="1" height="37" border="0" alt="" /></td> </tr> <tr> <td colspan="4" align="center" valign="top" background="images/template.slice.18.png" style="vertical-align:top;"><p class="standard"> </p> <table width="80%" border="0"> <tr> <td colspan="2"> <?php if($messages){ //displayErrors($messages); } else { //echo("<p align=\"center\" class=\"standard\">Your account has been activated.</p><p align=\"center\" class=\"standard\">You now need to change your password. If you like you can also change your username, Remember that you only have 3 days to do so and this change will be permanent.</p>"); ?></td> </tr> <form name="ChangeDetails" method="post" action="<?=$_SERVER['PHP_SELF']?>"> <input type="hidden" name="activationid" value="<?php if($_GET['id']){ $id=$_GET['id']; echo($id); } elseif($_POST['activationid']){ $id=$_POST['activationid']; echo($id); } else { die("No ID") } ?>" /> <tr> <td width="50%"><div align="right" class="standard">New Username: </div></td> <td width="50%"><input name="login" type="text" id="login" size="35" maxlength="30" /></td> </tr> <tr> <td><div align="right" class="standard">New Password:</div></td> <td><input name="password" type="password" id="password" size="35" maxlength="30" /></td> </tr> <tr> <td><div align="right" class="standard">Re-enter password:</div></td> <td><input name="passwordc" type="password" id="passwordc" size="35" maxlength="30" /></td> </tr> <tr> <td><div align="right" class="standard">Please enter the code: </div></td> <td> <?php require_once('recaptchalib.php'); $publickey = "6Le4fsESAAAAAKMOHb8aaiyDfGRJyr0y0EU7dXm-"; // you got this from the signup page echo recaptcha_get_html($publickey); ?> </td> </tr> <tr> <td> </td> <td><input type="submit" name="submit" id="submit" value="Change your details" /></td> </tr> </form> </table> </td> <td><img src="images/spacer.gif" width="1" height="450" border="0" alt="" /></td> </tr> <tr> <td colspan="4" background="images/template.slice.19.png"> </td> <td><img src="images/spacer.gif" width="1" height="50" border="0" alt="" /></td> </tr> <tr> <td colspan="9" background="images/template.slice.20.png"> </td> <td><img src="images/spacer.gif" width="1" height="40" border="0" alt="" /></td> </tr> </table> </div> </body> </html> <?php } ?> Thanks to all you kind people that take your time to read and help me with this problem. I'm sorry if it is a really simple problem I missed out that makes me look like a right idiot and wasted your time, but that's me I'm always missing stuff out like that, I do proof read though just sometimes not good enough. Thanks in advance! I'm calling a function that resets a couple arrays: public function resetStuff() { $this->someArray = array(); $this->someOtherArray = array(); } However, someOtherArray is not resetting!! How could that be? I can add debug statements to echo the size of the arrays before and after the function calls. It shows that: someArray went from n to 0 someOtherArray went from n to n How is that possible?? We are toying with the idea of using PHP to do sorting instead of our database to reduce load and scale. Basically what we would have is multidimensional arrays that are resturned from the SQL engine and we will need to sort them on a specific key in PHP. We have written this functionality, but are looking to make it faster ANYWAY possible. Do you guys see anyway to speed up this code, without throwing more hardware at the problem yet? Currently on our test server this code takes approx 2.4 - 2.6 seconds to execute. We would love others to try this code and report what it takes them to execute. We are shooting for sub 1 second time. Code: [Select] $array = array(); $temp = array(); for($i = 0; $i < 100000; $i++) { $temp['id'] = rand(10000, 99999); $temp['history_id'] = rand(100000000, 999999999); $array[] = $temp; } //// // Start timer //// $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; //// // Actual sort //// usort($array, function($a, $b) { //Compare numbers if ($a['history_id'] == $b['history_id']) { return 0; } return ($a['history_id'] < $b['history_id']) ? -1 : 1; }); //// // End timer //// $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $endtime = $mtime; $totaltime = ($endtime - $starttime); //// // Output execution time //// echo "Executed in: <strong>". $totaltime ."</strong> seconds."; This is my website: www.wearenip.com/home.html This is the menu that should appear on the left hand side, but doesn't: www.wearenip.com/menu.php This is my server's output saying that php is running just fine: http://wearenip.com/phpinfo.php I'm using this code in the left side bar div: Code: [Select] <?php include("menu.php"); ?> The PHP file will not display from the HTML file no matter what I do. I've tried using every possible combination of file linking including /menu.php ./menu.php and even the full http://www.wearenip.com/menu.php etc etc etc I'm genuinely upset about this. Any help would be greatly appreciated. PS: I can't get any PHP file to properly include in any HTML file on any computer I have. Nothing displays whatsoever regardless of what is in the PHP file, even if it's just a text word. Doesn't matter if it's hosted on a PHP compatible internet server or just on a local server or just on the local machine itself. Nothing. SOLVED, sorry. ... but i can't work it out. all i want to do is; if ( $this_item exists within the table ) { do a } else { do b } for example, $this_item = 'john', and i want the script to do (a) if he's in the table, or (b) if he isn't. thank you! so I have an xml string the following expression $xpath = $response->xpath('/atom:feed/atom:entry/atom:content'); returns the following array SimpleXMLElement Object ( [@attributes] => Array ( [type] => application/vnd.google-earth.kml+xml ) [Placemark] => SimpleXMLElement Object ( [name] => M1 [description] => SimpleXMLElement Object ( ) [Style] => SimpleXMLElement Object ( [IconStyle] => SimpleXMLElement Object ( [Icon] => SimpleXMLElement Object ( [href] => http://maps.gstatic.com/intl/en_ALL/mapfiles/ms/micons/blue-dot.png ) ) ) [Point] => SimpleXMLElement Object ( [coordinates] => -79.395018,43.645423,0.0 ) ) ) However what I'm trying to get are the coordinates, but neither $xpath = $response->xpath('/atom:feed/atom:entry/atom:content/Placemark'); OR $xpath = $response->xpath('/atom:feed/atom:entry/atom:content/Placemark/child::*'); work I even tried just loading atom:content into an array and going from there no luck. Any ideas. Oh. BTW this might help http://code.google.com/apis/maps/documentation/mapsdata/developers_guide_protocol.html#RetrievingFeatures It shouldn't be that difficult I just don't know how to do it myself. I'm using the following code for a simple navigation, i has been placed in the content of my home page, it works fine however i don't know how to set the home page. <div id="content"> <?php $page = $_GET['page']; $file = $page.".php"; if(file_exists($file)) { include($file); } else { include "error.php"; } ?> </div> Hi -- This query seems to be problematic because the UPDATE is not being performed. Could you please take a gander and let me know what is the problem? BTW, the table "teamy" does contain 630 records. Thanks in advance! $sql = "SELECT COUNT( * ) AS records FROM teamy" ; $result = mysql_query( $sql ) ; if ( ! $result ) { die ( __line__ . "_teamy_" . mysql_error() ) ; } $a_count = mysql_fetch_assoc($result); if ( $a_count['records'] = 0 ) { echo "No records found in teamy." ; } else { /*** Update r_rost_rma ***/ $sql = "UPDATE r_rost_rma JOIN teamy ON r_rost_rma.student_id = teamy.student_id SET r_rost_rma.teachername = teamy.team WHERE RTRIM( UPPER( r_rost_rma.localcourse ) ) = 'HOMEROOM'" ; $result = mysql_query ( $sql ) ; if ( ! $result ) { die ( __line__ . "_update_r_rost_rma_" . mysql_error() ) ; } } Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\parkhall\quantities.php on line 21 This is the error message. This is the code. simple array query to display contents of table and I cant see where i have made the mistake. hopefully someone can help. <?php mysql_connect ("localhost", "******", "*****") or die ('I cannot connect to the database becuase: ' . mysql_error()); mysql_select_db ("matquant"); $query = mysql_query("SELECT * FROM quantities"); while ($row = mysql_fetch_array($query)) { //line referred to in error message echo "<br /> ID: " .$row ['id']. " material : " .$row ['material']. "quantity:" .$row['quantity']. "<br />";} ?> Please point out the probably glaring error. I'm relatively new to this and I am really not finding php easy to learn. Sorry this page is not available or has been accessed in error An error occurred in script 'C:\xampp\htdocs\public_html\login\plugins\delete_product.php' on line 45: Undefined variable: id Date/Time: 8-24-2010 00:50:10 Array ( [GLOBALS] => Array *RECURSION* [_POST] => Array ( ) [_GET] => Array ( [id] => 2 ) <?php # Script 9.2 - delete_product.php // This page is for deleting a album. require_once ('../includes/config.inc.php'); // Check for a valid product ID, through GET or POST: if ( (isset($id)) && (is_numeric($id)) ) { // From editproducts.php $id = $_GET['id']; } elseif ( (isset($_POST['id'])) && (is_numeric($_POST['id'])) ) { // Form submission. $id = $_POST['id']; } else { echo '<p class="error">Sorry this page is not available or has been accessed in error</p>'; } echo $id; require_once(MYSQL); // Check if the form has been submitted: if (isset($_POST['submitted'])) { if ($_POST['sure'] == 'Yes') { // Delete the record. // Make the query: $q = "DELETE FROM products WHERE product_id='$id' LIMIT 1"; $r = @mysqli_query ($dbc, $q); if (mysqli_affected_rows($dbc) == 1) { // If it ran OK. // Print a message: echo '<p>The Product has been deleted.</p>'; } else { // If the query did not run OK. echo '<p class="error">The Product could not be deleted due to a system error.</p>'; // Public message. echo '<p>' . mysqli_error($dbc) . '<br />Query: ' . $q . '</p>'; // Debugging message. } // Make the query: $q = "DELETE FROM photos WHERE product_id='$id'"; $r = @mysqli_query ($dbc, $q); } else { // No confirmation of deletion. echo '<p>The Product has NOT been deleted.</p>'; } } else { // Show the form. // Retrieve the albums information: $q = "SELECT name FROM products WHERE product_id='$id' Limit 1"; $r = @mysqli_query ($dbc, $q); if (mysqli_num_rows($r) == 1) { // Valid user ID, show the form. // Get the user's information: $row = mysqli_fetch_array ($r, MYSQLI_NUM); $form = $_SERVER['PHP_SELF']; // Create the form: echo '<form action="' . $form . '" method="post"> <h1>Delete ' . $row[0] . '?</h1> <p>Are you sure you want to delete ' . $row[0] . '?<br /> <p><b>Warning if you delete this album all content inside of it will be losed!</b><br /> <input type="radio" name="sure" value="Yes" /> Yes <input type="radio" name="sure" value="No" checked="checked" /> No</p> <p><input type="submit" name="submit" value="Submit" /></p> <input type="hidden" name="submitted" value="TRUE" /> <input type="hidden" name="id" value="' . $id . '" /> </form>'; } } mysqli_close($dbc); ?> Hi guys,
I am trying to echo multiple calendar events from a mysql table and order them by the date column.
There are several events on each day so I am trying to echo the date once then list the associated events under that date.
Such as
2014-05-10
Event 1, event 2, event 3
2014-05-11
Event 1, event 2, event 3
instead of
2014-05-10 event 1,
2014-05-10 event 2,
2014-05-10 event 3,
2014-05-11 event 1 etc...
This is my coding so far:
while($row = mysqli_fetch_assoc($result)) { $dutydate = $row['MyDate']; if($dutydate != $previousdate) { echo $dutydate.'<br />'; } elseif(!empty($dutydate)) { echo $dutydate.'<br />'; } echo $event1.' | '.$event2.' | '.$event3.'<br />'; $previousdate = $dutydate; } ?> Hello, i am trying to create a simple funtion that i can all upon to "turn off a website" i am calling the function by <?php siteonline(n); ?> and the function is function siteonline($msg){ $offlinecheck = mysql_query("SELECT * FROM acp") or die(mysql_error()); $siteoffline = mysql_fetch_array($offlinecheck); $ifsiteoffline = $siteoffline['site_offline']; $offline = $siteoffline['offline_msg']; if ($ifsiteoffline == "y") { echo("$offline"); die();} } now this will turn off the site but it shows no message what so ever and i can not figure out why can anyone help? Cheers, Ok I got this column "date_reg" on my table which has a "datetime" type. It's giving me a value like "2012-04-20 04:28:03" The problem is, when I'm trying to insert on that column using this format Code: [Select] <?php $datenow = date('m/d/Y h:i:s a', time()); ?> it's giving me a value of "0000-00-00 00:00:00" which is suppose to be the current date and time the user add on that table. Anyone knows how I can fix this? I am thining this will be pretty simple for someone to help me with, I have been hassling with it for several hours and really feel dumb that I can't get it to work. Here is the problem - I have one script wherein I have a form that passes a variable using Post method. I have previously assigned a value "A" to a variable $rtn the input is: <input name="Rtn" type="hidden" value="<?php echo $rtn; ?> /> In the script that I am calling I first get the value of the variable: $rtn = (_POST['Rtn']); then there is other stuff goin on and I come to an if stmt: if ($rtn == "A" { do some stuff } else { echo $rtn; } It will never get into the do some stuff - it always falls through to the else the output is \'A\' I have tried to use double quotes, single quotes, used stripslasches and addslashes funtions, trim, and various combination of all of these. Nothing I do seem to get me into the first part of the if stmt, to do some stuff. Ok I decided to brush up on some functions and this one was giving me a hard time. Basically the if condition is printing the statement even though its not what the expression was asking for. I'm positive I am just missing something small, but I can't figure it out. Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xm1ns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Counting Words...</title> </head> <body> <?php function count_words() { $totalwords = str_word_count($_POST['total']); $amountneeded = $_POST['amount']; $wordsneeded = $amountneeded - $totalwords; $extrawords = $totalwords - $amountneeded; if (isset($_POST['submitted'])) { if(str_word_count($_POST['totalwords']) <= $_POST['amountneeded']) { print "\nYou need $wordsneeded more words"; } else { print "\nYou wrote an extra $extrawords words"; } if(str_word_count($_POST['totalwords']) == $_POST['amountneeded']) { print "You hit the jackpot and got just as much words as you needed"; } } } ?> <form action="wordcount.php" method="post"> <p>Words Needed: <input type="text" name="amount" value="" /></p> <p>Copy and Paste your words:</p> <textarea name="total" rows="5" cols="30"></textarea> <input type="submit" name="submit" value="Count My Words" /> <input type="hidden" name="submitted" value="true" /> </form> <?php count_words(); ?> </body> </html> I have a script.. it works fine on my localhost.. now i am trying to work it with on my remote server.. the script reads the folder in my c drive and shows me the file on display here is the code <?php $main_dir ="C:\\xampp\\htdocs\\xtrajam"; $main_open = opendir($main_dir); while(($main_file = readdir($main_open)) != FALSE) { echo $main_file."<br />"; } closedir($main_open); ?> Now the thing is this works fine on local host as it can easy access the path C:\\xampp\\htdocs\\xtrajam Now i want this path to be accessed sumhow wen i try it on my remote server.. how should i do that like when i run the script online it reads the contents from my c drive directory..? is it sumhow possible? Hi all, I have been working on this script for over 5 hours, the script used to work but I have recreated some html code in the html form and I think it may have something to do with why the script does not work but I can not see it. Hopefully an extra pair of eyes can help. The I have tested what the $_POST['title'] below echos in the php script and it does carry the value to the php page, but the IF statement does not work. Here it is: html form in a php page: Code: [Select] <form action="testform.php" method="post"> <fieldset style="border:none"> <ul class="controls"> <li> <label for="label">Title</label> <input name="title" id="title" type="text" class="text" maxlength="" value="grumman aa4" /> </li> <li> <label for="label">Aircraft Registration</label> <input name="reg" id="label" type="text" class="text" maxlength="6" value="G-qwea" style="text-transform:uppercase;" /> </li> <li> <input name="Button" type="submit" class="button centered" /> </li> </ul> </fieldset></form> The part of the PHP page that does not work is below. If the php below just says if ($_POST['reg'] == "")... it works but as soon as I put || $_POST['title'] it does not work. I have also tried if ($_POST['reg'] && $_POST['title'] == "")... which DOES work? testform.php <?php if ($_POST['reg'] || $_POST['title'] == "") { $fillinform = "Please fill in all the form to add a listing."; include("saleform.php"); exit(); } ?> Hi! I am not great at using php but do use it to process forms on websites. I always use the same script and just change the relevant sections for each website. This usually works with no problems. I am writing an mailing list subscribe/unsubscribe form my website and it works fine as in I get the email sent through with all the information on it and the automated reply gets sent out etc. The problem is that once the user hits Submit instead of going to the redirect page it stays on the php page. if($from == '') {print "You have not entered an email, please go back and try again";} else { if($name == '') {print "You have not entered a company name, please go back and try again";} else { $send = mail($to, $subject, $body, $headers); $send2 = mail($from, $subject2, $autoreply, $headers2); if($send) {header( "Location: http://www.hillsideweb.co.uk/unsubthanks.html" );} Like I say this exact script works on another site of mine perfectly well, can someone please help me solve this. The form is found on http://www.hillsideweb.co.uk/unsubscribe.html I hope this makes sense! Many thanks Swenglish |