PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
mohson
Forum Contributor
Posts: 372 Joined: Thu Dec 02, 2004 6:58 am
Location: London
Post
by mohson » Wed Jul 19, 2006 6:53 am
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.
Benjamin
Site Administrator
Posts: 6935 Joined: Sun May 19, 2002 10:24 pm
Post
by Benjamin » Wed Jul 19, 2006 6:59 am
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'; }
mohson
Forum Contributor
Posts: 372 Joined: Thu Dec 02, 2004 6:58 am
Location: London
Post
by mohson » Wed Jul 19, 2006 7:04 am
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??
mohson
Forum Contributor
Posts: 372 Joined: Thu Dec 02, 2004 6:58 am
Location: London
Post
by mohson » Wed Jul 19, 2006 7:07 am
Apologies got rid of the signature thing at the bottom, no blank screen but no message either??
Benjamin
Site Administrator
Posts: 6935 Joined: Sun May 19, 2002 10:24 pm
Post
by Benjamin » Wed Jul 19, 2006 7:13 am
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
mohson
Forum Contributor
Posts: 372 Joined: Thu Dec 02, 2004 6:58 am
Location: London
Post
by mohson » Wed Jul 19, 2006 7:19 am
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> </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"> </font></td>
<td> </td>
</tr>
<tr>
<td><font face="Times New Roman, Times, serif"> <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> </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>
Benjamin
Site Administrator
Posts: 6935 Joined: Sun May 19, 2002 10:24 pm
Post
by Benjamin » Wed Jul 19, 2006 7:28 am
What do you see in your browser address bar after you submit a form?
mohson
Forum Contributor
Posts: 372 Joined: Thu Dec 02, 2004 6:58 am
Location: London
Post
by mohson » Wed Jul 19, 2006 7:39 am
No change remains the same .........../Uorgs
mohson
Forum Contributor
Posts: 372 Joined: Thu Dec 02, 2004 6:58 am
Location: London
Post
by mohson » Wed Jul 19, 2006 8:53 am
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!