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 acer asus bios bsod computer crash drive driver drivers error ethernet excel freeze games gaming graphics hard drive hardware hdmi internet laptop malware memory monitor motherboard netgear network printer problem ram random registry router slow software sound trojan usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless xbox
Search
Search for:
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
php/MySQL form inside Javascript - is it possible?

Reply  
Thread Tools
twmprys's Avatar
Computer Specs
Member with 106 posts.
 
Join Date: Jun 2009
Experience: Beginner
03-Nov-2009, 01: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 82 posts.
 
Join Date: Feb 2006
Location: New Jersey
Experience: Intermediate
03-Nov-2009, 02:18 PM #2
Could you perhaps post your code?
twmprys's Avatar
Computer Specs
Member with 106 posts.
 
Join Date: Jun 2009
Experience: Beginner
03-Nov-2009, 02:26 PM #3
Wow! you're so kind - got to go out, will reply later.
twmprys's Avatar
Computer Specs
Member with 106 posts.
 
Join Date: Jun 2009
Experience: Beginner
03-Nov-2009, 07: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 offline
Senior Member with 3,637 posts.
 
Join Date: Oct 2006
03-Nov-2009, 09: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 106 posts.
 
Join Date: Jun 2009
Experience: Beginner
05-Nov-2009, 12:31 PM #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

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




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



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 03:27 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.