-
November 18th, 2008, 12:59 PM
#1
PHP form
I am having a strange issue with this form built in PHP and html:
Code:
<form name="submit_call" id="submit_call" method="post" action="rpc/portal-submit-rpc.php" >
<?
if ($location == "CAR" OR $location == "BIZ" OR $location == "SPC") {
include("care_groups.php");
}
?>
<table width="580" class="bill">
<tr class="group"><td colspan="4">Zlinky Data Entry</td></tr>
<tr class="item odd">
<td>Account Number</td>
<td><input readonly = "readonly" id="cu_number" name="cu_number" value="<?php echo $Cuno;?>" /></td>
<td></td>
<td></td>
</tr>
<tr class="item even">
<td>State</td>
<td><select id="state" name="state" ><?php include("includes/states.inc"); ?></select></td>
<td>CRS Ticket (if any)</td>
<td><input type="text" id="abs_tkt" name="abs_tkt" size="10" value="<?php echo $Crs; ?>" /></td>
</tr>
<tr class="item odd">
<td>Issue</td>
<td><select name="issuemain" id="issuemain" ></select></td>
<td>Disposition</td>
<td><select name="issuesecond" id="issuesecond" ></select></td>
</tr>
<tr class="item even">
<td colspan="4"><textarea name="note" id="note" rows="8" cols="70" class="field" onKeyDown="limitText(this.form.note,this.value.length,255);"></textarea></td>
</tr>
<tr class="item odd">
<td colspan="4"> <input type="submit" id="submit" value="Submit" />
<input type="hidden" name="tech" id="tech" value="<?php echo $Webusr; ?>" />
</td></tr>
</table>
<p>Username: <?php echo $Webusr; ?></p>
</form>
So, what this SHOULD do is pass the information via POST to "rpc/portal-submit-rpc.php", which is a page that inserts the data into MySQL, and show a confirmation page that lists everything that was submitted or shows the MySQL error, if there is one.
Now, the $location variable is set depending on the department or location the tech is in. If this is set to "CAR", "BIZ", or "SPC" then they will have a set of radio buttons, which is brought in via:
include("care_groups.php");
here is the code for care_groups.php:
Code:
<div>
<input type="radio" name="function_group" value="resi" onclick="initListGroup('care_resi', document.submit_call.issuemain, document.submit_call.issuesecond);" />Residential
<input type="radio" name="function_group" value="biz" onclick="initListGroup('care_biz', document.submit_call.issuemain, document.submit_call.issuesecond);" />Business
<input type="radio" name="function_group" value="rss" onclick="initListGroup('care_ssresi', document.submit_call.issuemain, document.submit_call.issuesecond);" />Residential Special Services
<input type="radio" name="function_group" value="bss" onclick="initListGroup('care_ssbiz', document.submit_call.issuemain, document.submit_call.issuesecond);" />Business Special Services
<input type="radio" name="function_group" value="retention" onclick="initListGroup('retention', document.submit_call.issuemain, document.submit_call.issuesecond);" />Retention
</div>
The problem is this,
if the $location is NOT "CAR", "BIZ", or "SPC" this page works perfectly, and shows the confirmation page, and life is peachy.
if the $location IS "CAR", "BIZ", or "SPC" this page will reload and show the same default information. The odd thing is that the information still gets passed to the database, which means that
it must be sending the info to "rpc/portal-submit-rpc.php", but its just not showing that page (which should be the confirmation screen).
The only difference between the 2 is the group of radio buttons. And I have nothing on the page that would casue it to reload. I have no idea what is causing this problem.
Any help at all is appreciated. Thank you.
-
November 19th, 2008, 05:11 AM
#2
Re: PHP form
So submitting brings you back to the page? Have you looked into the code of the php file that actually puts into MySQL. Since it reaches there, and that is what brings in the output, then it might be that which causes the problem.
-
November 19th, 2008, 09:26 AM
#3
Re: PHP form
there is nothing on that page that could redirect to the first one.
here is the code:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<link rel="stylesheet" type="text/css" href="css/general.css"/>
<link rel="stylesheet" type="text/css" href="css/nims.css"/>
<link href="http://e/NEXTop/inc/default.css" rel="stylesheet" type="text/css"/>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Zlinky Data Entry</title>
</head>
<body>
<?php
include("../includes/connect.inc");
if (isset($_POST['tech'])){
$tech = $_POST['tech'];
}
#Get the variables out
$cu_number=mysql_real_escape_string($_POST['cu_number']);
$issuemain=mysql_real_escape_string($_POST['issuemain']);
$issuesecond=mysql_real_escape_string($_POST['issuesecond']);
$state=mysql_real_escape_string($_POST['state']);
$note=mysql_real_escape_string($_POST['note']);
$abs_tkt=mysql_real_escape_string($_POST['abs_tkt']);
$function_group = $_POST['function_group'];
if ($tech != ""){
$info_query="SELECT agent_id, locator FROM members where username='$tech'";
$info_result=mysql_query($info_query);
$row1=mysql_fetch_row($info_result);
$tech_id=$row1['0'];
$locator=$row1['1'];
#figure out if it's an outbound or inbound call
# 1 = Res. Center inbound call
# 2 = Res. Center outbound call
# 3 - ABS inbound call
# 4 - ABS outbound call
# 5 - Care inbound call
# 6 - Care outbound call
# 7 - Repair Chat
if ($issuemain == 'Ticket Work') {
$call_type = 2;
}elseif ($issuemain == 'Technician Call Outbound') {
$call_type = 2;
}elseif ($issuemain == 'Escalation Email') {
$call_type = 2;
}elseif ($issuemain == 'ABS - Tickets/Outbound Calls') {
$call_type = 4;
}elseif ($issuemain == 'ABS Inbound Calls') {
$call_type = 3;
}elseif ($issuemain == 'Chat') {
$call_type = 7;
}else{
$call_type = 1;
}
if ($function_group == 'resi'){
$call_type = 5;
}elseif ($function_group == 'biz'){
$call_type = 6;
}elseif ($function_group == 'bss'){
$call_type = 8;
}
#Now go ahead and insert the data, now that we have everything we want
$insert_query = "INSERT
INTO data
(cu_number, issue, state, note, tech, tech_id, locator, abs_tkt, call_type)
VALUES
('$cu_number', '$issuemain - $issuesecond', '$state', '$note', '$tech', '$tech_id', '$locator', '$abs_tkt', '$call_type')";
mysql_query($insert_query);
}
if ($error_num == 0){
$insert_id = mysql_insert_id();
echo "<p>The following information has been submitted:</p><br/>
ID: $insert_id <br/>
Customer number: $cu_number <br/>
Issue: '$issuemain - $issuesecond' <br/>
State: $state <br/>
Note: $note <br/>
Ticket: $abs_tkt <br/>
Call Type: $call_type <br/>
User: $tech <br/>
User_ID: $tech_id <br/>
Department: $locator <br/>";
}else{
echo "<p>There seems to be an error:</p><br/>
Error:$error_num: $error_msg";
}
mysql_close($conn);
?>
</body>
</html>
I think it is very odd that it will work fine without the set of radio buttons, but it causes problems with them. I have even tried getting rid of the include() and coding the radio buttons into the same spot, but I still have the same issue.
I have no idea what is causing this.
-
November 19th, 2008, 10:16 AM
#4
Re: PHP form
I'm not sure if I understand the problem, if I get it I'm thinking the page is reloading without reason?
I did go through the whole code, and the only thing I would be curious to see is the content of the initListGroup() function
Last edited by bobo; November 19th, 2008 at 10:22 AM.
-
November 19th, 2008, 12:19 PM
#5
Re: PHP form
Are you sure you aren't duplicating variable names?
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
November 20th, 2008, 08:58 AM
#6
Re: PHP form
Originally Posted by bobo
I'm not sure if I understand the problem, if I get it I'm thinking the page is reloading without reason?
I did go through the whole code, and the only thing I would be curious to see is the content of the initListGroup() function
Its is reloading the page, but it shouldn't be. It should just be going to 'portal-submit-rpc.php'.
It is important to note that even though the page looks like it just reloads... the 'portal-submit-rpc.php' script MUST have been called in there somewhere, because the information that is submitted gets into the database, and 'portal-submit-rpc.php' does the insert into MySQL.
But it only has this problem when $location IS "CAR", "BIZ", or "SPC" . If $location is set to anything else, then it works the way I intended (It submits to 'portal-submit-rpc.php' and does not reload the page)
I cannot figure out what is causing the page to reload
initListGroup() is a javascript function that changes the contents of the dropdown lists ("issuemain" and "issuesecond"). I don't think the problem is with this function. I use the same javascript all over the site and never had an issue with it.
Originally Posted by PeejAvery
Are you sure you aren't duplicating variable names?
I don't think so. I have double checked and I cannot see any duplicate variables. If you do, please point it out to me.
Last edited by Nightwolf629; November 20th, 2008 at 09:02 AM.
-
November 20th, 2008, 09:57 AM
#7
Re: PHP form
hmmm.... this is like the twilight zone...
at this point, myself being on apache, unix I usually go check the error logs or this case the access logs, I don't know what system your running this on but if you can check the access logs of the server you might catch something.
Also just for a joke... rename your $location var to something else... like $tech_location or something then try it... I know it shouldn't matter, but since we're dealing with something that doesn't make sense anyways, thats what I would try next.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|