Hi all,
The below code should be allowing me to modify entries which i choose from the script before hand, however it give the 500 error code.
it generates ...... http://tramp-space.co.uk/edittest/te...hp?master_id=1
where 1 is the record number (which exists)
Im baffled. can anybody help me please? -
<?php
-
if ((!$_POST) || (isset($_GET["master_id"] !=" ")) {
-
//haven't seen the form, so show it
-
$display_block = "
-
<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
-
-
if (isset($_GET["master_id"])) {
-
//connect to database
-
$mysqli = mysqli_connect("localhost", "web88-farmer", "whitep8", "web88-farmer");
-
-
//get first, last names for display/tests validity
-
$get_names_sql = "SELECT concat_ws('', f_name, l_name) AS display_name
-
FROM master_name WHERE id = '".$_GET["master_id"]."'";
-
$get_names_res = mysqli_query($mysqli, $get_names_sql)
-
or die(mysqli_error($mysqli));
-
-
if (mysqli_num_rows($get_names_res) == 1) {
-
while ($name_info = mysqli_fetch_array($get_names_res)) {
-
$display_name = stripslashes($name_info['display_name']);
-
}
-
}
-
}
-
-
if (isset($display_name)) {
-
$display_block .= "<p>Adding information for
-
<strong>$display_name</strong>:</p>";
-
} else {
-
$display_block .= "
-
<p><strong>First/Last Names:</strong><br/>
-
<input type=\"text\" name=\"f_name\" size=\"30\" maxlength=\"75\">
-
<input type=\"text\" name=\"l_name\" size=\"30\" maxlength=\"75\">";
-
}
-
$display_block .= "<p><strong>Address:</strong><br/>
-
<input type=\"text\" name=\"address1\" size=\"30\"></p>
-
<input type=\"text\" name=\"address2\" size=\"30\"></p>
-
-
<p><strong>City/State/Zip:</strong><br/>
-
<input type=\"text\" name=\"city\" size=\"30\" maxlength=\"50\">
-
<input type=\"text\" name=\"county\" size=\"20\" maxlength=\"20\">
-
<input type=\"text\" name=\"post_code\" size=\"10\" maxlength=\"10\"></p>
-
-
<p><strong>Address Type:</strong><br/>
-
<input type=\"radio\" name=\"add_type\" value=\"home\" checked> home
-
<input type=\"radio\" name=\"add_type\" value=\"work\"> work
-
<input type=\"radio\" name=\"add_type\" value=\"other\"> other</p>
-
-
<p><strong>Telephone Number:</strong><br/>
-
<input type=\"text\" name=\"tel_number\" size=\"30\" maxlength=\"25\">
-
<input type=\"radio\" name=\"tel_type\" value=\"home\" checked> home
-
<input type=\"radio\" name=\"tel_type\" value=\"work\"> work
-
<input type=\"radio\" name=\"tel_type\" value=\"other\"> other</p>
-
-
<p><strong>Fax Number:</strong><br/>
-
<input type=\"text\" name=\"fax_number\" size=\"30\" maxlength=\"25\">
-
<input type=\"radio\" name=\"fax_type\" value=\"home\" checked> home
-
<input type=\"radio\" name=\"fax_type\" value=\"work\"> work
-
<input type=\"radio\" name=\"fax_type\" value=\"other\"> other</p>
-
-
<p><strong>Email Address:</strong><br/>
-
<input type=\"text\" name=\"email\" size=\"30\" maxlength=\"150\">
-
<input type=\"radio\" name=\"email_type\" value=\"home\" checked> home
-
<input type=\"radio\" name=\"email_type\" value=\"work\"> work
-
<input type=\"radio\" name=\"email_type\" value=\"other\"> other</p>
-
-
<p><strong>Personal Note:</strong><br/>
-
<textarea name=\"note\" cols=\"35\" rows=\"3\" wrap=\"virtual\"></textarea></p>";
-
-
if ($_GET) {
-
$display_block .= "<input type=\"hidden\" name=\"master_id\" value=\"".$_GET["master_id"]."\">";
-
}
-
-
$display_block .= "<p><input type=\"submit\" name=\"submit\" value=\"Add Entry\"></p>
-
</form>";
-
-
} else if ($_POST) {
-
//time to add to tables, so check for required fields
-
if ((($_POST["f_name"] == "") || ($_POST["l_name"] == "")) &&
-
(!isset($_POST["master_id"]))) {
-
header("Location: addentry.php");
-
exit;
-
}
-
-
//connect to database
-
$mysqli = mysqli_connect("localhost", "web88-farmer", "whitep8", "web88-farmer");
-
-
if (!$_POST["master_id"]) {
-
//add to master_name table
-
$add_master_sql = "INSERT INTO master_name (date_added, date_modified, f_name, l_name)
-
VALUES (now(), now(), '".$_POST["f_name"]."', '".$_POST["l_name"]."')";
-
$add_master_res = mysqli_query($mysqli, $add_master_sql) or die(mysqli_error($mysqli));
-
-
//get master_id for use with other tables
-
$master_id = mysqli_insert_id($mysqli);
-
} else {
-
$master_id = $_POST["master_id"];
-
}
-
-
if (($_POST["address1"]) || ($_POST["address2"]) ||($_POST["city"]) || ($_POST["county"]) || ($_POST["post_code"])) {
-
//something relevant, so add to address table
-
$add_address_sql = "INSERT INTO address (master_id, date_added, date_modified,
-
address1, address2, city, county, post_code, type) VALUES ('".$master_id."',
-
now(), now(), '".$_POST["address1"]."', '".$_POST["address2"]."', '".$_POST["city"]."',
-
'".$_POST["county"]."' , '".$_POST["post_code"]."' , '".$_POST["add_type"]."')";
-
$add_address_res = mysqli_query($mysqli, $add_address_sql) or die(mysqli_error($mysqli));
-
}
-
-
if ($_POST["tel_number"]) {
-
//something relevant, so add to telephone table
-
$add_tel_sql = "INSERT INTO telephone (master_id, date_added, date_modified,
-
tel_number, type) VALUES ('".$master_id."', now(), now(),
-
'".$_POST["tel_number"]."', '".$_POST["tel_type"]."')";
-
$add_tel_res = mysqli_query($mysqli, $add_tel_sql) or die(mysqli_error($mysqli));
-
}
-
-
if ($_POST["fax_number"]) {
-
//something relevant, so add to fax table
-
$add_fax_sql = "INSERT INTO fax (master_id, date_added, date_modified,
-
fax_number, type) VALUES ('".$master_id."', now(), now(),
-
'".$_POST["fax_number"]."', '".$_POST["fax_type"]."')";
-
$add_fax_res = mysqli_query($mysqli, $add_fax_sql) or die(mysqli_error($mysqli));
-
}
-
-
if ($_POST["email"]) {
-
//something relevant, so add to email table
-
$add_email_sql = "INSERT INTO email (master_id, date_added, date_modified,
-
email, type) VALUES ('".$master_id."', now(), now(),
-
'".$_POST["email"]."', '".$_POST["email_type"]."')";
-
$add_email_res = mysqli_query($mysqli, $add_email_sql) or die(mysqli_error($mysqli));
-
}
-
-
if ($_POST["note"]) {
-
//something relevant, so add to notes table
-
$add_notes_sql = "UPDATE personal_notes set note = '".$_POST["note"]."' WHERE
-
master_id = '".$master_id."'";
-
$add_notes_res = mysqli_query($mysqli, $add_notes_sql) or die(mysqli_error($mysqli));
-
}
-
mysqli_close($mysqli);
-
$display_block = "<p>Your entry has been added. Would you like to <a href=\"addentry.php\">add another</a>?</p>";
-
}
-
?>
-
<html>
-
<head>
-
<title>Add an Entry</title>
-
</head>
-
<body>
-
<h1>Add an Entry</h1>
-
<?php echo $display_block; ?>
-
</body>
-
</html>
-
2 4298 mwasif 802
Recognized Expert Contributor
You should use PHP CODE tags instead of CODE. This helps others to read the source code easily. Turn On PHP Debugging Messages.
What are you trying to do in this line?
[PHP]if ((!$_POST) || (isset($_GET["master_id"] !=" ")) {[/PHP]
See how isset() works.
pbmods 5,821
Recognized Expert Expert
Heya, Whitey.
500 errors are usually caused by permissions issues or an error in a .htaccess file.
Make sure all your scripts have execute permissions, and check the ownership. The files should be owned and/or in the same group as the web server (usually 'www' or 'apache').
If you are using .htaccess files, verify that there are no errors or typos.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: |
last post by:
I am accessing the same error-containing ASP page on an ISP server using w2k
IE6 but with different effect.
On the first computer I get several line of HTML outputed by ASP, shown
correctly by the browser, followed by a descriptive error message:
Microsoft VBScript runtime error '800a000b'
Division by zero
followed by the number of the error-making line
|
by: Ben |
last post by:
hi
when I try to excecute an ASP (either JS or VB) script to
say, access a database record, I get an Internal Server
Error HTTP 500.100
Why? and HOW CAN I FIX THIS?
Thanks
|
by: Patrick Masson |
last post by:
Hello,
Our configuration :
Apache 2.0.53
PHP 5.0.4
PC Windows 2000
MATLAB 6.1
We work on a consulting project in France which involves MATLAB Web server,
|
by: Rod |
last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some
reason, opening some ASP.NET applications we wrote is producing the
following error message:
"The Web server reported the following error when attempting to create or
open the Web project located at the following URL:
'http://localhost/WebApplication1'. 'HTTP/1.1 500 Internal Server Error'."
|
by: jf li |
last post by:
I have a Asp.net web application and a Asp.net Web service application. The
Web application is using HtmlInputFile to get a 50M size of file selected by
end user, read the data of this file and pass the data to the web service. I
already modified both web.config files and changed maxRequestLength to
60000(kb). When I debug the upload process, it seems the Web application can
get the 50M file and read the data without problem, but when the...
| |
by: Lieven |
last post by:
Hey,
I had a hard disc problem last week on my server. I replaced the disc and
copied al the files to the new hard disc, everything works fine again except
some php scripts that are using the mail() function. When executing these
scripts I get this error:
"500 Internal Server Error
The server encountered an internal error or misconfiguration and was unable
to complete your request.
|
by: ticfranca |
last post by:
Hi, I'm getting this error in the code below:
sub Pega_recorde {
$database = 'bundinha';
$host = 'localhost';
$usuario = 'myhumoradm';
$senha = 'my8xr2d2';
$dbh=DBI->connect("DBI:mysql:database=$database;host=$host","$usuario","$senha") or die "Can't open DB: $!";
|
by: ticfranca |
last post by:
i'm getting an error at the line : $sth->execute() or die $dbh->errstr;
the error is : The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator
I already check permission of cgi-bin folder and the permission of this script file.
Everything is OK. Somebody help me?Please..
Internal Server Error
|
by: rooznamechi.h |
last post by:
Hi,
I use Url rewriting on my website and my website works normally , but
I don't know why Google crawlers can not read my pages . For example
look at address below :
http://www.labkhandha.com/Article/265/default.aspx
As you can see you can see the page but here is Google's Web crawl
error for this page and all rewrite pages :
500 (Internal server error)
The server encountered an error and can't fulfill the request
|
by: guillaume.braux |
last post by:
Hello,
I am running WS2008 + IIS7 + FASTCGI + ZendCore.
I have not modified the default ZendCore php.ini configuration file.
Actualy, any kind of PHP error, warning or notice gives me immediately
a IIS 500 Error (Internal Server Error).
It is a good thing in production environnement.
For debuging purposes, I want temporary to be able to see PHP warnings
and errors embedded on the html page.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |