Mourning the loss of our friend, WhitPhil.
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
 
Web Design & Development
Tag Cloud
access audio black screen blue screen boot bsod connection crash dell desktop driver dvd email error excel firefox hard drive hardware hijackthis internet keyboard laptop malware monitor network networking outlook problem processor recovery registry cleaner router safe mode screen slow sound spyware tdlwsp.dll trojan upgrade vba video virus vista vundo windows windows 7 windows vista windows xp wireless
Search
Search for:
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
php/MySQL form inside Javascript - is it possible?

Tip: Click here to scan for System Errors and Optimize PC performance
[ Sponsored Link ]

 
Thread Tools
twmprys's Avatar
Computer Specs
Member with 69 posts.
 
Join Date: Jun 2009
Experience: Beginner
03-Nov-2009, 12:59 PM #1
php/MySQL form inside Javascript - is it possible?
I've got a javascript show/hide script containing a php form posting to MySql. When I press submit I get "forbidden" message. Anybody know if it possible to do this or do I have to find another way?
SNewman's Avatar
Member with 57 posts.
 
Join Date: Feb 2006
Location: New Jersey
Experience: Intermediate
03-Nov-2009, 01:18 PM #2
Could you perhaps post your code?
twmprys's Avatar
Computer Specs
Member with 69 posts.
 
Join Date: Jun 2009
Experience: Beginner
03-Nov-2009, 01:26 PM #3
Wow! you're so kind - got to go out, will reply later.
twmprys's Avatar
Computer Specs
Member with 69 posts.
 
Join Date: Jun 2009
Experience: Beginner
03-Nov-2009, 06:47 PM #4
This is the code. It is part of a while loop which outputs all the rows of a database. It is for an online newsletter. There are two types of story and headline. I want the user to be able to edit stories and their associated headlines by pressing on EDIT STORY which reveals editable text via the javascript function.

PHP Code:
$submit $_POST['form']; 
if (isset(
$submit)) {
$result mysql_query("UPDATE newsletter SET atitle='{$_POST['atitle']}', astory='{$_POST['astory']}', btitle='{$_POST['btitle']}', bstoy='{$_POST['bstory']}' WHERE id='{$_POST['id']}'");

}
echo 
'<FORM ACTION="" enctype="multipart/form-data" METHOD="POST" name="form">
  <input type=hidden name="id" VALUE="' 
.  $row['id'] . '"><tr><td width="50%"><textarea rows="1" cols="60" name="atitle">' nl2br(stripslashes($row['atitle'])) . '</textarea><br /><textarea rows="20" cols="60" name="astory">' nl2br(stripslashes($row['astory'])) . '</textarea></td><td with="50%"><textarea rows="1" cols="60" name="btitle">' nl2br(stripslashes($row['btitle'])) . '</textarea><br /><textarea rows="20" cols="60" name="bstory">' nl2br(stripslashes($row['bstory'])) . '</textarea></td></tr><tr><td colspan="2"><input type="submit" value="Save changes" name="form"></form></table></div></td></tr><tr><td colspan="2" class="style2" ><div align="right"><div align="right"><a href="javascript:;" onClick="document.getElementById(\'' $row['id'] . '\').style.display=\'block\';">[EDIT STORY]</a></div></td></tr>';
}
 
?> 
MMJ's Avatar
MMJ MMJ is online now
Distinguished Member with 3,519 posts.
 
Join Date: Oct 2006
03-Nov-2009, 08:54 PM #5
Quote:
Originally Posted by twmprys View Post
I've got a javascript show/hide script containing a php form posting to MySql. When I press submit I get "forbidden" message. Anybody know if it possible to do this or do I have to find another way?
http://www.google.com/#hl=en&q=form+submit+403+error
twmprys's Avatar
Computer Specs
Member with 69 posts.
 
Join Date: Jun 2009
Experience: Beginner
05-Nov-2009, 11:31 AM #6
Further to this issue, I find I can post small amounts of information, but when the strings are long, I get the FORBIDDEN message. Are there limits to posting this type of information? I'm only trying to send text to longtext fields in MySql. Is the Javascript to blame?
Reply Bookmark and Share

Smart Search

Find your solution!



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.

Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -5. The time now is 01:35 PM.
Copyright © 1996 - 2009 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.
Powered by Cermak Technologies, Inc.