Page 1 of 1

Record Added Successfully

Posted: Wed Jul 19, 2006 6:53 am
by mohson

Code: Select all

mysql_select_db("contact_management_system",$link) or die("Could not select database");
 $sql = "INSERT INTO organisations (org_id,person_id, orgname, web_url, notes ) VALUES ('$org_id','$person_id','$orgname','$web_url', '$notes')";
 $result = mysql_query($sql,$link) or die ( mysql_error($link));;
 header ("location: http://www.soi.city.ac.uk/organisation/ ... Uorgs.html");
?>
When I fill out a form and press save the form actions this insert code, the header information then loads a blank form. How do I insert a messge saying as the subject of this post suggests 'Record Added' and then load the blank form?

Simple for someone I bet.

Posted: Wed Jul 19, 2006 6:59 am
by Benjamin

Code: Select all

mysql_select_db("contact_management_system",$link) or die("Could not select database");
$sql = "INSERT INTO organisations (org_id,person_id, orgname, web_url, notes ) VALUES ('$org_id','$person_id','$orgname','$web_url', '$notes')";

if ($result = mysql_query($sql,$link)) {
    header ("location: http://www.soi.city.ac.uk/organisation/ ... ?Sent=true"); 
} else {
    die ( mysql_error($link));
}

Code: Select all

if ((isset($_GET['Sent'])) and ($_GET['Sent'] == 'true')) { echo 'Your message has been sent'; }

Posted: Wed Jul 19, 2006 7:04 am
by mohson

Code: Select all

<?php
/* Connecting, selecting database */
$link = mysql_connect("xxx", "xx", "xxx")
   or die("Could not connect : " . mysql_error());

mysql_select_db("contact_management_system",$link) or die("Could not select database");
 $sql = "INSERT INTO organisations (org_id,person_id, orgname, web_url, notes ) VALUES ('$org_id','$person_id','$orgname','$web_url', '$notes')";
 if ($result = mysql_query($sql,$link)) {
    header ("location: http://www.soi.city.ac.uk/organisation/ ... ?Sent=true");
} else {
    die ( mysql_error($link));
} 

if ((isset($_GET['Sent'])) and ($_GET['Sent'] == 'true')) { echo 'Your message has been sent'; }
signature:
?>
Returns a blank screen??

Posted: Wed Jul 19, 2006 7:07 am
by mohson
Apologies got rid of the signature thing at the bottom, no blank screen but no message either??

Posted: Wed Jul 19, 2006 7:13 am
by Benjamin

Code: Select all

if ((isset($_GET['Sent'])) and ($_GET['Sent'] == 'true')) { echo 'Your message has been sent'; }
Needs to go in Uorgs.html where you want the message to display. If your server isn't setup to parse html as php, you may need to change the file extension from .html to .php

Posted: Wed Jul 19, 2006 7:19 am
by mohson
thanks again my server is set up to parse html as php so thats not the problem. I put this php code in body of my Uorgs html but no luck

Code: Select all

</head>

<body onLoad="focus()"> 

<?php
if ((isset($_GET['Sent'])) and ($_GET['Sent'] == 'true')) { echo 'Your message has been sent'; }
?>

<form method="post" action="processorgs.html" 

onSubmit="return checkme()" name=Feedback>
  <p>&nbsp; </p>
  <table width="100%" height="176"  border="0">
    <tr> 
      <td width="17%" height="24"><font face="Times New Roman, Times, serif"><strong>Web 
        Link</strong></font></td>
      <td width="20%"><font face="Times New Roman, Times, serif">
        <input name="web_url" type="text"size="20"style="color: #000000; 
		background-color: #ADD8E6">
        </font></td>
    
    <tr> 
      <td><font face="Times New Roman, Times, serif"><strong>Organisation</strong></font></td>
      <td><font face="Times New Roman, Times, serif">
        <input name="orgname" type="text"style="color: #000000; 
background-color: #ADD8E6" size="30" maxlength="100">
        </font></td>
      <td><font face="Times New Roman, Times, serif">&nbsp; </font></td>
      <td>&nbsp;</td>
    </tr>
    <tr> 
      <td><font face="Times New Roman, Times, serif">&nbsp;<strong>Notes</strong></font></td>
      <td><font face="Times New Roman, Times, serif">
        <textarea name="notes"style="color: #000000; 
	  		background-color: #ADD8E6"></textarea>
        </font><font face="Times New Roman, Times, serif">
      <td>&nbsp;</td>
    </tr>
    <tr> 
  </table>
  
  <p>
    <input type="submit" name="submit" value = "Enter Information">
	<input type="reset" name="reset" value="clear" style= "color:#000000 ">
  </p>
  
</form>

Posted: Wed Jul 19, 2006 7:28 am
by Benjamin
What do you see in your browser address bar after you submit a form?

Posted: Wed Jul 19, 2006 7:39 am
by mohson
No change remains the same .........../Uorgs

Posted: Wed Jul 19, 2006 7:42 am
by Benjamin
Are you saying it's not being redirected to http://www.soi.city.ac.uk/organisation/ ... ?Sent=true

Posted: Wed Jul 19, 2006 8:53 am
by mohson
Sorry for the delay, my mistake, where I work they have a content management system the changes made were fine but it was pointing back to the live website -[ where I hadnt published the record] therefore when I replaced the http.soi.city with the url of the test site the message appeared.

Thanks for the help!! your a star!