PHP - Couple Minor Issue Starting Up, Wrong Email Path, No Final Sign Up Button, And I Need The Header A Little Bigger.
I just installed this new script here http://webhost.pro/domain-check.php it's a basic domain availability tool.
I am trying to make a form that can be used on any page forward to this page with the content. The page loads with this in the url webhost.pro/domain-check.php?domain=dwhs.net and will run the page. So I can make a form that just submits to that page and sends the details. I made this page for testing http://webhost.pro/test.html But no go, here is the code: <form id="search" action="/domain-check.php" method="GET"> <input type="text" name="s"> <a onClick="document.getElementById('search').submit()" class="button1">Search</a> <div class="clear"></div> </form> Thanks! Similar TutorialsCode: [Select] header('Location: ' . $register_success); Code: [Select] $register_success = 'register_success.php'; The header function above gets executed after a successful registering, and the variable is stated in the path.php file, which gets included into the header.php file, which also is included into the page, and also into the page with the register form. The register form is contained in the path model/register/register_script.php, and the file register_success.php is in the same folder. The problem I am having is that the header function does redirect to controller/register/register_success.php this used to be the previous location of that file. I am wondering is the old path saved somewhere in the cache, and this all is actually a caching problem? It does not seem to be a caching problem of the internet browser because I cleaned the cache out. What else could be the cause for this problem? If it is a caching problem, which cache could be, as in in which location? Hey guys I am getting a Headers error that I havent been able to get rid of for the past 3 hours. I would really appreciate some help. <?php mysql_connect("localhost", "", "")or die("cannot connect"); mysql_select_db("test")or die("cannot select DB"); $tbl_name="test_mysql"; $sql="SELECT * FROM $tbl_name"; $result=mysql_query($sql); $count=mysql_num_rows($result); ?> <form name="form1" method="post" action=""> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="0"> <tr> <td align="center"><strong>Row</strong></td> <td align="center"><strong>Month - Date</strong></td> <td align="center"><strong>Message</strong></td> <td align="center"><strong>Title</strong></td> <td align="center"><strong>Icon</strong></td> </tr> <?php while($rows=mysql_fetch_array($result)){ ?> <tr> <td align="center"><?php $id[]=$rows['id']; ?><?php echo $rows['id']; ?></td> <td align="center"><input style="border: 1px solid #C3C3C3;height: 20px;" name="month[]" MAXLENGTH="3" size="3" type="text" id="month" value="<?php echo $rows['month']; ?>"> <input style="border: 1px solid #C3C3C3;height: 20px;" name="date[]" MAXLENGTH="2" size="2" type="text" id="date" value="<?php echo $rows['date']; ?>"> </td> <td align="center"><input style="border: 1px solid #C3C3C3;height: 20px;" name="message[]" size="70" type="text" id="message" value="<?php echo $rows['message']; ?>"></td> <td align="center"><input style="border: 1px solid #C3C3C3;height: 20px;" name="title[]" size="70" type="text" id="title" value="<?php echo $rows['title']; ?>"></td> <td align="center"> <select name="test[]" style="display:block; width:200px" class="mydds"> <option value="icon_phone.gif" title="icon/icon_phone.gif">Phone</option> <option value="icon_sales.gif" title="icon/icon_sales.gif">Graph</option> </select> </td> </tr> <?php } ?> <tr> <td colspan="4" align="center"><br><input type="submit" name="Submit" value="Submit"></td> </tr> </table> </td> </tr> </form> <?php if (isset($_POST['Submit'])) { for($i=0;$i<$count;$i++){ $month = $_POST['month']; $date = $_POST['date']; $message = $_POST['message']; $title = $_POST['title']; $monthday = $month[$i]."<br>".$date[$i]; $sql1="UPDATE $tbl_name SET monthday='$monthday', month='$month[$i]', date='$date[$i]', message='" . mysql_real_escape_string($message[$i]) . "', title='" . mysql_real_escape_string($title[$i]) . "' WHERE id='$id[$i]'"; $result1 = mysql_query($sql1); } header("location:update2.php"); } ?> Please Hey, I'm trying to open a .php file and read a comment block that is in the beginning of the file. I'm having some trouble in that nothing is being echoed out. Here is the reading file: <?php $fb = fopen("tepl.php", "r"); $data = fread($fb, 8192); fclose($fb); var_dump($data); ?> here is the file (tepl.php) being read: <?php /* Name: Test Plugin 1 URI: http://www.theorangeday.com/plugintest/ Description: This is just a test plugin because I need to test how this thing is going to work overall. Author: Thomas Francis Author URI: http://www.theorangeday.com/ Version: 0.1 */ function test_plugin(){ echo "we loaded the test plug"; } ?> the var_dump returns Code: [Select] string(321) " " What's wrong here? Hello am new to php and am working with a config file. But it always give me a wrong path to file /homedomains/xxxxx/public_html/ no / between home an domains.. am frustrated on how to solve this... please help me in this an attaching the script file.. config file too Hi all I am running XAMPP on my laptop and working with files not in the localhost directory. For functions like fopen, there is no problem, I specify a path starting from the localhost directory to wherever I want to work and that's fine. For some reason though, it is NOT working with IMG SRC. I get my PHP to generate the following line of code : <IMG SRC = "http://localhost/../../../wherever/android.jpg"> (which in this case points to C:\wherever\android.jpg) However the browser misses the middle bit of the URL out and interprets it just as localhost/wherever/android.jpg - which clearly doesn't exist ! Likewise, if I try typing the address straight into the address bar, the '../../../' bit of it immediately vanishes. I've tried formatting the URL in a variety of ways, none of them seem to work, where am I going wrong ? Many thanks ! Hi! So I'm working for someone, and they want me to fix this error in a PHP file.. Here is the code: <?php include_once('config.php'); $online = mysql_query("SELECT * FROM bots WHERE status LIKE 'Online'"); $offline = mysql_query("SELECT * FROM bots WHERE status LIKE 'Offline'"); $dead = mysql_query("SELECT * FROM bots WHERE status LIKE 'Dead'"); $admintrue = mysql_query("SELECT * FROM bots WHERE admin LIKE 'True'"); $adminfalse = mysql_query("SELECT * FROM bots WHERE admin LIKE 'False'"); $windows8 = mysql_query("SELECT * FROM bots WHERE so LIKE '%8%'"); $windows7 = mysql_query("SELECT * FROM bots WHERE so LIKE '%7%'"); $windowsvista = mysql_query("SELECT * FROM bots WHERE so LIKE '%vista%'"); $windowsxp = mysql_query("SELECT * FROM bots WHERE so LIKE '%xp%'"); $unknown = mysql_query("SELECT * FROM bots WHERE so LIKE 'Unknown'"); $totalbots = mysql_num_rows(mysql_query("SELECT * FROM bots")); $onlinecount = 0; $offlinecount = 0; $deadcount = 0; $admintruecount = 0; $adminfalsecount = 0; $windows8count = 0; $windows7count = 0; $windowsvistacount = 0; $windowsxpcount = 0; $unknowncount = 0; while($row = mysql_fetch_array($online)){ $onlinecount++; } while($row = mysql_fetch_array($offline)){ $offlinecount++; } while($row = mysql_fetch_array($dead)){ $deadcount++; } while($row = mysql_fetch_array($admintrue)){ $admintruecount++; } while($row = mysql_fetch_array($adminfalse)){ $adminfalsecount++; } while($row = mysql_fetch_array($windows8)){ $windows8count++; } while($row = mysql_fetch_array($windows7)){ $windows7count++; } while($row = mysql_fetch_array($windowsvista)){ $windowsvistacount++; } while($row = mysql_fetch_array($windowsxp)){ $windowsxpcount++; } while($row = mysql_fetch_array($unknown)){ $unknowncount++; } $statustotal = $onlinecount + $offlinecount + $deadcount; $admintotal = $admintruecount + $adminfalsecount; $sototal = $windows7count + $windowsvistacount + $windowsxpcount + $unknowncount; ?> Can anyone tell me the error here, can how to fix it? Hi there, i follow a tutorial from www.phpwebcommerce.com and i'm having path problem for 'add to cart' button. Demo from phpwebcommerce: http://www.phpwebcommerce.com/plaincart/index.php I have modified some changes, i'm putting the 'add to cart' button to 1st level instead of 2nd level. Example, under all category (car & manga) i choose car, then inside car category list there is a 'add to cart' button under all car product instead of clicking inside and show 'add to cart' button. productDetail.php: Code: [Select] <?php if (!defined('WEB_ROOT')) { exit; } $product = getProductDetail($pdId, $catId); // we have $pd_name, $pd_price, $pd_description, $pd_image, $cart_url extract($product); ?> <table width="100%" border="0" cellspacing="0" cellpadding="10"> <tr> <td align="center"><img src="<?php echo $pd_image; ?>" border="0" alt="<?php echo $pd_name; ?>" width="230" height="170"></td> <td valign="middle"> <strong><?php echo $pd_name; ?></strong><br> Price : <?php echo displayAmount($pd_price); ?><br> <?php // if we still have this product in stock // show the 'Add to cart' button if ($pd_qty > 0) { ?> <input type="button" name="btnAddToCart" value="Add To Cart >" onClick="window.location.href='<?php echo $cart_url; ?>';" class="addToCartButton"> <?php } else { echo 'Out Of Stock'; } ?> </td> </tr> <tr align="left"> <td colspan="2"><?php echo $pd_description; ?></td> </tr> </table> I copy this code out from productDetail.php: Code: [Select] <input type="button" name="btnAddToCart" value="Add To Cart >" onClick="window.location.href='<?php echo $cart_url; ?>';"> productList.php: Code: [Select] <?php if (!defined('WEB_ROOT')) { exit; } $productsPerRow = 2; $productsPerPage = 8; //$productList = getProductList($catId); $children = array_merge(array($catId), getChildCategories(NULL, $catId)); $children = ' (' . implode(', ', $children) . ')'; $sql = "SELECT pd_id, pd_name, pd_price, pd_thumbnail, pd_qty, c.cat_id FROM tbl_product pd, tbl_category c WHERE pd.cat_id = c.cat_id AND pd.cat_id IN $children ORDER BY pd_name"; $result = dbQuery(getPagingQuery($sql, $productsPerPage)); $pagingLink = getPagingLink($sql, $productsPerPage, "c=$catId"); $numProduct = dbNumRows($result); // the product images are arranged in a table. to make sure // each image gets equal space set the cell width here $columnWidth = (int)(100 / $productsPerRow); ?> <table width="100%" border="0" cellspacing="0" cellpadding="20"> <?php if ($numProduct > 0 ) { $i = 0; while ($row = dbFetchAssoc($result)) { extract($row); if ($pd_thumbnail) { $pd_thumbnail = WEB_ROOT . 'images/product/' . $pd_thumbnail; } else { $pd_thumbnail = WEB_ROOT . 'images/no-image-small.png'; } if ($i % $productsPerRow == 0) { echo '<tr>'; } // format how we display the price $pd_price = displayAmount($pd_price); echo "<td width=\"$columnWidth%\" align=\"center\"><a href=\"" . $_SERVER['PHP_SELF'] . "?c=$catId&p=$pd_id" . "\"><img src=\"$pd_thumbnail\" border=\"0\" width=\"230\" height=\"170\"><br>$pd_name</a><br>Price : $pd_price<br> <input type=\"button\" name=\"btnAddToCart\" value=\"Add To Cart >\" onClick=\"window.location.href='<?php echo $cart_url; ?>';\" >"; // if the product is no longer in stock, tell the customer if ($pd_qty <= 0) { echo "<br>Out Of Stock"; } echo "</td>\r\n"; if ($i % $productsPerRow == $productsPerRow - 1) { echo '</tr>'; } $i += 1; } if ($i % $productsPerRow > 0) { echo '<td colspan="' . ($productsPerRow - ($i % $productsPerRow)) . '"> </td>'; } } else { ?> <tr><td width="100%" align="center" valign="center">No products in this category</td></tr> <?php } ?> </table> <p align="center"><?php echo $pagingLink; ?></p> The code i copy from productDetail.php i paste in productList.php at line48, it show the 'add to cart' button but when i click on it, it cant add to my shopping cart and it show error: Notice: Undefined variable: cart_url in C:\Domains\xxxxxxxx\wwwroot\xxxxxxxx\plaincart\include\productList.php on line 48 Notice: Undefined variable: cart_url in C:\Domains\xxxxxxxx\wwwroot\xxxxxxxx\plaincart\include\productList.php on line 48 Notice: Undefined variable: cart_url in C:\Domains\xxxxxxxx\wwwroot\xxxxxxxx\plaincart\include\productList.php on line 48 Notice: Undefined variable: cart_url in C:\Domains\xxxxxxxx\wwwroot\xxxxxxxx\plaincart\include\productList.php on line 48 Will Appreciate For Any Help....Thank you in advanced & sorry for the bad English. Can I use this path? I didn't know if I could pull in images into a subdomain from another domain ../mysite.com/assets/img/avatars/defaultuser.jpg Hello Everyone, i am fairly new in PHP coding, and facing some issue with include function in php. my problem is as follows: in a php script which is located at "/include/cart.php" i am including a html page "cart_add.html" which is at location "/cart_add.html" now whenever i am clicking on any links on this page "cart_add.html" browser looking for all other pages at location "/include/" instead of "/" so in the browser i see url as "http://localhost/include/index.html" instead of "http://localhost/index.html" so i get error like this : [an error occurred while processing this directive] The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please help me to resolve this issue. Thanks very much I'm getting the error below when I run my script on my remote server. I'm providing a relative path to this file and it works on my local server (XAMPP). I've researched it a bit and I think it has to do with how I indicate the path to the file on the remote server. I don't know what to do about it, however. I hope someone can help me. The file is in the indicated directory on the remote server and there are no permissions issues that I am aware of. The mystery phrase is: include_path='.:/opt/cpanel/ea-php73/root/usr/share/pear'
--Kenoli Warning: require(bootstrap/start.php): failed to open stream: No such file or directory in /home4/ournight/public_html/tio-new/__classes/pi_admin.php on line 3 Warning: require(bootstrap/start.php): failed to open stream: No such file or directory in /home4/ournight/public_html/tio-new/__classes/pi_admin.php on line 3 Fatal error: require(): Failed opening required 'bootstrap/start.php' (include_path='.:/opt/cpanel/ea-php73/root/usr/share/pear') in /home4/ournight/public_html/tio-new/__classes/pi_admin.php on line 3
if anyone out there fancy's helping the needy please can you cast your eyes over my mess! and possibly help me find my way out of this maze? So im useing a third party form, and a third party php script.......... cant get them to work together . form script : [color=red//-------------------------------------------------[/color] <form action="phpquote.php" method="post" id="reserve-form"> <div class="box"> <div class="left-top-corner"> <div class="right-top-corner"> <div class="border-top"></div> </div> </div> <div class="border-left"> <div class="border-right"> <div class="xcontent"> <h5>Get an online quote for your journey</h5> <p>please fill in all fields for your quote.</p> <fieldset> <div class="field"> <label>Customer Information</label> <input type="text" id="name" value="Name" onblur="if(this.value==''){this.value='Name'}" onfocus="if(this.value=='Name'){this.value=''}" /> </div> <div> <input type="text" id="number" value="Phone" onblur="if(this.value==''){this.value='Phone'}" onfocus="if(this.value=='Phone'){this.value=''}" /> </div> </fieldset> <fieldset class="style1"> <div class="field"> <label>Travel Date/ Time</label> <select id="year"> <option>2010</option> <option>2011</option> </select> <select class="sel-1" id="month"> <option>Jan</option> <option>Feb</option> <option>Mar</option> <option>Apr</option> <option>May</option> <option>Jun</option> <option>Jul</option> <option>Aug</option> <option>Oct</option> <option>Sep</option> <option>Nov</option> <option>Dec</option> </select> <select class="sel-2" id="date"> <option>1</option> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> <option>7</option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> <option>11</option> <option>12</option> <option>13</option> <option>14</option> <option>15</option> <option>16</option> <option>17</option> <option>18</option> <option>19</option> <option>20</option> <option>21</option> <option>22</option> <option>23</option> <option>24</option> <option>25</option> <option>26</option> <option>27</option> <option>28</option> <option>29</option> <option>30</option> <option>31</option> </select> </div> <div class="field"> <select class="sel-2" id="time"> <option>00</option> <option>01</option> <option>02</option> <option>03</option> <option>04</option> <option>05</option> <option>06</option> <option>07</option> <option>08</option> <option>09</option> <option>10</option> <option>11</option> <option>12</option> <option>13</option> <option>14</option> <option>15</option> <option>16</option> <option>17</option> <option>18</option> <option>19</option> <option>20</option> <option>21</option> <option>22</option> <option>23</option></select> <select class="sel-2" id="time"> <option>00</option> <option>15</option> <option>30</option> <option>45</option> </select> </div> <div class="field"> <label>No. Passangers</label> <select id="year"> <option>01</option> <option>02</option> <option>03</option> <option>04</option> <option>05</option> <option>06</option> </select> </div> </fieldset> <fieldset class="style2"> <div class="field"> <label>Pickup Information</label> <input type="text" id="where" value="Pickup Address" onblur="if(this.value==''){this.value='Pickup Address'}" onfocus="if(this.value=='Pickup Address'){this.value=''}" /> </div> <div> <select id="where"> <option>or Airport</option> <option>Stansted</option> <option>Gatwick</option> <option>Heathrow</option> <option>Luton</option> </select> </div> </fieldset> <fieldset class="style2 style3"> <div class="field"> <label>Drop-off Information</label> <input type="text" id="to" value="Drop-off Address" onblur="if(this.value==''){this.value='Drop-off Address'}" onfocus="if(this.value=='Drop-off Address'){this.value=''}" /> </div> <div> <select id="to"> <option>or Airport</option> <option>Stansted</option> <option>Gatwick</option> <option>Heathrow</option> <option>Luton</option> </select> </div> </fieldset> </div> </div> </div> <div class="left-bot-corner"> <div class="right-bot-corner"> <div class="border-bot"><a href="#" class="link2" onclick="document.getElementById('reserve-form').submit()"><em><b>Get Quote</b></em></a></div> </div> </div> </div> </form> //----------------------------------------------------------------------------- php script //----------------------------------------------------------------------------- <?php //--------------------------Set these paramaters-------------------------- // Subject of email sent to you. $subject = 'Results from Contact form'; // Your email address. This is where the form information will be sent. $emailadd = 'm.mcdade@hotmail.co.uk'; // Where to redirect after form is processed. $url = 'http://www.mock.thetaxirank.co.uk/thankyou.html'; // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty. $req = '0'; // --------------------------Do not edit below this line-------------------------- $text = "Results from form:\n\n"; $space = ' '; $line = ' '; foreach ($_POST as $key => $value) { if ($req == '1') { if ($value == '') {echo "$key is empty";die;} } $j = strlen($key); if ($j >= 20) {echo "Name of form element $key cannot be longer than 20 characters";die;} $j = 20 - $j; for ($i = 1; $i <= $j; $i++) {$space .= ' ';} $value = str_replace('\n', "$line", $value); $conc = "{$key}:$space{$value}$line"; $text .= $conc; $space = ' '; } mail($emailadd, $subject, $text, 'From: '.$emailadd.''); echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">'; ?> //----------------------------------------------------------------------------- any advice will be appreciated..... thanks in advance to any kind souls !!! I cant seem to get the right format for adding in the echo to this header Code: [Select] <?php header("Location: search_goaulds.php?goauld= "echo $grab_goauld"); ?> I am trying to understand how Cache-Control works when you define using header function in PHP. If I specify Cache-Control "max-age=3600, must-revalidate" in php using header function Does browser/proxy cache(liek Squid/Akamai) go all the way to orgin server to validate before max-age expires? Or will it serve content from cache till max-age expires? What if I want to a browser to check for any updated file before max-age expires ? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <style> .error {color: #FF0000;} h6 { font-family: bookman old style; font-size:20px; text-align: center; font-weight: normal; } h5 { font-family: bookman old style; font-size:15px; text-align: center; font-weight: normal; } </style> <?php $nameErr = $emailErr = $websiteErr = $categoryErr; $name = $email = $comment = $website = $reset = $category; if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["name"])) { $nameErr = "Name is required"; } else { $name = test_input($_POST["name"]); if (!preg_match("/^[a-zA-Z ]*$/",$name)) { $nameErr = "Only letters and white space allowed"; } } if (empty($_POST["email"])) { $emailErr = "Email is required"; } else { $email = test_input($_POST["email"]); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $emailErr = "Invalid email format"; } } if (empty($_POST["website"])) { $websiteErr = "URL is required"; } else { $website = test_input($_POST["website"]); if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$website)) { $websiteErr = "Invalid URL"; } } if (empty($_POST["comment"])) { $comment = ""; } else { $comment = test_input($_POST["comment"]); } if (empty($_POST["category"])) { $categoryErr = "Category is required"; } else { $category = test_input($_POST["category"]); } if (!empty($_POST['name']) && !empty($_POST['email']) && !empty($_POST['website']) && !empty($_POST['category'])) { $myemail = "links@loadsofads.com"; $subject = "Link Submission"; $message = "Your Link Submission form has been submitted by: Website Name: $name E-mail: $email URL: $website Category: $category Description: $comment"; mail($myemail, $subject, $message); header('location:submitthanks.php'); }} function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?> <?php include'header.php'?> <h6>Link Submission</h6> <h5><p><span class="error">* required field.</span></p> <form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> Name Of Site: <input type="text" name="name" value=""> <span class="error">* <?php echo $nameErr;?></span> <br><br> E-mail: <input type="text" name="email" value=""> <span class="error">* <?php echo $emailErr;?></span> <br><br> URL: <input type="text" name="website" value=""> <span class="error">* <?php echo $websiteErr;?></span> <br><br> Description: <textarea name="comment" rows="5" cols="40"></textarea> <br><br> Category Of Site: <select size="1" name="category"> <option value=""> -- Please select -- </option> <option>Arts</option> <option>Business</option> <option>Computers</option> <option>Games</option> <option>Health</option> <option>Home</option> <option>Kids and Teens</option> <option>News</option> <option>Recreation</option> <option>Reference</option> <option>Science</option> <option>Shopping</option> <option>Society</option> <option>Sports</option> <option>World</option> </select><span class="error">* <?php echo $categoryErr;?></span> <br><br> <input type="submit" name="submit" value="Submit"> <input type="reset" name="reset" value="Reset Form"> </form> <?php include'footer.php'?>Hello All, OK so I have been at this for a few days now and everywhere I go to learn or read information it says the same thing, to redirect the code is header('location:mypage.php');exit(); but it just will not redirect it every thing I try it does not load the redirect page. it clears the form and sits there, I do not know why! Can please someone please help me and see why it is not doing it? Thanks Hi Everyone was kind enough to help with my last issue and am now nearly there. The data actually populates correctly now in my database, however, it will not direct me to my redirect. I get the error Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\loginsystem\Permnew.php:4) in C:\xampp\htdocs\loginsystem\Permnew.php on line 124 This is the redirect i am trying to do anyone any ideas? Thanks Steve
<?php require "header.php"; ?> <main> <div class="wrapper-main"> <div class="welcomelogged"> <p>Adding A Permanent New Starter<p> </div> <form class="form-addperm" action="" method="post"> <table id="Tableperm" width="1000px;" border="0"> <tr> <th align="right" scope="row"><label for="select">Week Commencing</label></th> <td><select name="WeekComm"> <option value="WC 6th April">WC 6th April</option> <option value="WC 13th April">WC 13th April</option> <option value="WC 20h April">WC 20h April</option> <option value="WC 27h April">WC 27h April</option> </select></td> </tr> <tr> <th align="right" scope="row"><label for="StartDate">Start Date</label></th> <td><input type="date" name="StartDate" placeholder="Start Date"></td> </tr> <tr> <th align="right" scope="row"><label for="select1">Consultant</label></th> <td><select name="Consultant"> <option value="Steven Buntin">Steven Buntin</option> <option value="Sam Ahmed">Sam Ahmed</option> <option value="David Millington">David Millington</option> <option value="Steven Nixon">Steven Nixon</option> <option value="Grahame Walsh">Grahame Walsh</option> <option value="Helal Ahmed">Helal Ahmed</option> </select></td> </tr> <tr> <th align="right" scope="row"><label for="FirstName">First Name</label></th> <td><input type="text" name="FirstName" placeholder="First Name"></td> </tr> <tr> <th align="right" scope="row"><label for="LastName">Last Name</label></th> <td><input type="text" name="LastName" placeholder="Last Name"></td> </tr> <tr> <th align="right" scope="row"><label for="ClientName">Client Name</label></th> <td><input type="text" name="ClientName" placeholder="Client Name"></td> </tr> <th align="right" scope="row"><label for="Position">Position</label></th> <td><input type="text" name="Position" placeholder="Position"></td> </tr> <th align="right" scope="row"><label for="Comments">Comments</label></th> <td><input type="text" name="Comments" placeholder="Comments"></td> </tr> <tr> <th align="right" scope="row"><label for="Salary">Salary</label></th> <td><input type="varchar" name="Salary" placeholder="Salary"></td> </tr> <tr> <th align="right" scope="row"><label for="ChargePercentage">Charge Percentage</label></th> <td><input type="varchar" name="ChargePercentage" placeholder="ChargePercentage"></td> </tr> <ty> <th align="right" scope="row"><label for="GPNotes">GP Notes</label></th> <td><input type="text" name="GPNotes" placeholder="GPNotes"></td> </tr> </table> <button type="submit" name="addstarter">Add Starter</button> </form> </div> </main> <?php $dBServername = "localhost"; $dBUsername = "root"; $dBPassword = ""; $dBName = "loginsystemtut"; mysqli_report(MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT); $conn = mysqli_connect($dBServername, $dBUsername, $dBPassword, $dBName); if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } if (isset($_POST['addstarter'])) { $WeekComm = $_POST['WeekComm']; $StartDate = $_POST['StartDate']; $Consultant = $_POST['Consultant']; $FirstName = $_POST['FirstName']; $LastName = $_POST['LastName']; $ClientName = $_POST['ClientName']; $Position = $_POST['Position']; $Comments = $_POST['Comments']; $Salary = $_POST['Salary']; $ChargePercentage = $_POST['ChargePercentage']; $GPNotes = $_POST['GPNotes']; $sql = ("INSERT INTO permanent (WeekComm, StartDate, Consultant, FirstName, LastName, ClientName, Position, Comments, Salary, ChargePercentage, GpNotes) values (?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); $stmt = mysqli_stmt_init($conn); if (!mysqli_stmt_prepare($stmt, $sql)) { // If there is an error we send the user back to the signup page. header("Location: ../signup.php?error=sqlerror"); exit(); } else { mysqli_stmt_bind_param($stmt,"sssssssssss",$WeekComm,$StartDate,$Consultant,$FirstName,$LastName,$ClientName,$Position,$Comments,$Salary,$ChargePercentage,$GPNotes); mysqli_stmt_execute($stmt); } header("Location: ../loginsystem/permnew1.php?success"); exit(); } ?>
Hi, I'm having trouble with redirect my page to another page. what I have is a page that uses a form to insert into a database, the form is then processed to another page (insert.php) which will insert the information inserted in the form. I'm trying to work out how I could redirect the user to another page once the data has been successfully inserted. this is what I have now: insert.php Code: [Select] <?php $link = mysql_connect('ericlee.dot5hostingmysql.com', 'user', 'password'); if (!$link) { die('Could not connect: ' . mysql_error()); } //echo 'Connected successfully'; mysql_select_db('remarch', $link); $sql="INSERT INTO posts (Name, Location, Fault, Other, Description) VALUES ('$_POST[name]','$_POST[location]','$_POST[fault]','$_POST[other]','$_POST[description]')"; header('Location: about.html'); if (!mysql_query($sql,$link)) { die('Error: ' . mysql_error()); } mysql_close($link); ?> I'm pretty sure it's just the placing of the code Quote header('Location: about.html'); . Would be appreciated if someone could give me some guidance Thank you in advance! Hello everyone, I'm building a wordpress site, which of course is in PHP. One of the things I did was start with a template I moderately liked and have edited it until I do like it. I know the problems with debugging that this causes but I'm too far invested now to back out. One of the things I added to the header was some simple scroll-over images that have links. I created a div-id in the CSS style sheet for where this will go in the header and put in the image using the simple rollover image creator in dreamweaver. The images work fine on every page BUT the blog posts themselves. Then it's just an empty void without the images themselves. Any insight to where the problem could lie, in the header, in the pages, ect, would be really helpful. Thanks! I am having an issue with some scripts on my site. It won't redirect and emits an error. This occurs for only some of my scripts, but for the ones in which it does occur, it occurs 100% of the time. On a previous server, I didn't have this issue, now I do. I get the following error: Warning: Cannot modify header information - headers already sent by (output started at /www/zzl.org/f/a/n/fantasyboxingonline/htdocs/bg/train_stat.php:5) in /www/zzl.org/f/a/n/fantasyboxingonline/htdocs/bg/train_stat.php on line 29 Below is the code to the page that emitted the error above (Note: session_start(); IS in autoupdater.php I'm not that stupid): <?php require_once("../autoupdater.php"); ?> <link rel="stylesheet" type="text/css" href="/style.css"/> <?php if(!$_SESSION["loggedin"]) { die("<b>You are not logged in, or you have been logged out. Please <a href=\"/login/\" target=\"_top\">login again!</a></b>"); } $id = $_GET["id"]; if($id > 4 || $id < 1) { die("<center><h2>An error occurred. You are trying to train an invalid statistic.</h2></center>"); } $userid = $_SESSION["userid"]; $time = time(); $stattraining = $_SESSION["stattraining"]; if($stattraining) { if($stattraining == 1) { $statname = "powerful"; } elseif($stattraining == 2) { $statname = "quick"; } elseif($stattraining == 3) { $statname = "skilled"; } elseif($stattraining == 4) { $statname = "durable"; } die("<center><h2>You cannot train! You are already training $statname!</h2></center>"); } mysql_query("UPDATE `users` SET `stattraining`='$id', `statstarttime`='$time' WHERE `userid`='$userid'", db_connect_select()); header("Location: training.php"); die(); ?> Any help or suggestions would be greatly appreciated. -Moon Afternoon all, Quick query; On the index.php page I have a hyperlink entitled LOGOUT. This allows the users to log out of their current session. The hyperlink directs to a logout.php page with the following contents: Code: [Select] <?php session_end(); ?> <html> <head></head> <body> <?php header('Location: index.php'); ?> </body> </html> Essentially; the code should end the session and redirect the browser back to the main page. Currently, the hyperlink does redirect to the logout.php page, but; - it doesn't return to the index.php page - if I click the back button, the session is still alive Can anyone assist? Is there a better way of doing this? This isn't something that hasn't been done before, but finding the topic in the forums has been difficult. Thanks in advance. |