Page 1 of 1

Parsing & into a table

Posted: Fri Oct 17, 2008 4:56 am
by funkymeerkat
Hi,

I have a script where the guys on the helpdesk can add any current issues into a form (for their clients), this once submitted, goes to a page where it asks them to confirm what they are posting is correct (at this stage the & symbol parses fine). Then they submit. At this point, anything typed after the & symbol does not get entered into the table...

I understand that to view & in HTML you need to parse it as &, however i am unsure how to do this. I can't really ask the guys to type that everytime they want to use that symbol as its ridicuolous.

Please see my code below... Any help would be much appreciated...

Added Issue

Code: Select all

<?php
 
$issue_client=$_POST['requiredissue_client'];
$issue_subject=$_POST['requiredissue_subject'];
$issue_content=$_POST['requiredissue_content'];
$issue_date=$_POST['issue_date'];
$issue_team=$_POST['requiredissue_team'];
$issue_posteduser=$_POST['issue_posteduser'];
$issue_time=$_POST['issue_time'];
 
echo "<font face=Verdana size=1><b>Please confirm that the following is correct...</b><br>";
echo "<br><br><b>Issue Client:</b> $issue_client<br>";
echo "<br><br><b>Issue Title:</b> $issue_subject<br>";
echo "<br><br><b>Issue:</b> $issue_content<br><br><br><br>";
 
echo "<b><a href='confirm_issue.php?issue_client=$issue_client&issue_subject=$issue_subject&issue_content=$issue_content&issue_date=$issue_date&issue_time=$issue_time&issue_team=$issue_team&issue_posteduser=$issue_posteduser'>Yes</a> | <a href='#' onClick='history.go(-1)'>No</a></b></font>";
?>
Confirmed Issue

Code: Select all

<?php 
$issue_client=$_GET['issue_client'];
$issue_subject=$_GET['issue_subject'];
$issue_content=$_GET['issue_content'];
$issue_date=$_GET['issue_date'];
$issue_team=$_GET['issue_team'];
$issue_posteduser=$_GET['issue_posteduser'];
$issue_time=$_GET['issue_time'];
 
include("includes\login_details.inc");
 
mysql_connect ($dbhost, $dbuser, $dbpass) or die (mysql_error()); //Connects to database 
 
//echo $dbhost. "<br/>";
//echo $dbuser. "<br/>";
//echo $dbpass. "<br/>";
//echo $dbname. "<br/>";
 
mysql_select_db ($dbname) or die (mysql_error()); //Selects your database 
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
 
$query = "INSERT INTO issues (issue_client, issue_team, issue_time, issue_date, issue_subject, issue_content, issue_posteduser) 
VALUES('$issue_client', '$issue_team', '$issue_time', '$issue_date', '$issue_subject', '$issue_content', '$issue_posteduser')";
 
//echo $query. "<br/>";
 
echo "";
 
$result = mysql_query($query) or die("Error: ". mysql_error());
 
?>

Re: Parsing & into a table

Posted: Sun Oct 19, 2008 12:41 am
by novice4eva
the function "htmlspecialchars" will help you convert the '&' to '&'