Jump to content

Optimising my form


Recommended Posts

So I have started my new site. So far with a little (lot) of help from you guys I have got quite far.

 

Its not pretty but it is almost funtional. Here is a quick recap:

 

crazymoonpics.heliohost.org on Stevie.

 

Site to be used as a prive IMDB type site where our productions can be listed and search upon. As I am not always around I want users to be able to add their own entries so I have created a form.

 

Now the form works, posts to my database as does the add person button which also posts. I now have two questions I need help on.

 

1. If I add a person and submit that entry to the database can I make it update the select box automatically so they do not have to reload the page and lose their settings?

 

2. Not all entries will have 10 cast members. Minimum is 2 and max is 10. Is there a way that I can set these up to either:

 

(a) only show when required

(B) select a blank option somehow so it does not post to the database

 

If you can help me sort these things out I think all the backend will be complete then for the form and I just have to move onto presenting the data which I think will be markedly easier.

 

Thanks to all that have helped so far, its been a brilliant learning experience. Thanks to all who hopefully help now.

 

Link to comment
Share on other sites

You could use jQuery to load some of that data via ajax.

 

I have been trying to figure out how to do this with AJax but I am struggling as I dont really know the in's and out's of JQuery or Ajax for that matter.

 

Basically I will click the add person button which opens a separate page, add the person, click submit and the page will close.

 

Does the Ajax portion need to go into the add person page or the page with the actual select boxes?

 

 

Link to comment
Share on other sites

This is how it will go:

 

Use window.open to open a window.

In the open window, call window.parent.myFunction when the user clicks submit.

In the parent window, myFunction will close the window, then call $('#identifier').load('http://www.com/yourform.php#identifier');

Link to comment
Share on other sites

  • 2 weeks later...

OK new question.

 

In my form crazymoonpics.heliohost.org/movieAdd.php I can add things into the fields no problem. However for some reason when I add a lot of text into the plot field it does not seem to save to my database.

 

I beleive it only occurs when I copy and paste.

 

The field in the db is setup as text but it still does not seem to save. Only when i manually type into the field.

 

Any ideas on what I can do to resolve this?

 

Link to comment
Share on other sites

  • 2 weeks later...
Probably the column storing your PLOT is too small; what type is it, varchar or text?

 

Hi,

 

I have tried both options. Also when I type in it seems ok. When I copy/paste text in it fails. Unless I only copy/paste one paragraph. Then it seems to work.

 

 

Anyone got any ideas on my little problem?

Link to comment
Share on other sites

I can't think of any reason why it would fail when you copied text.

 

Yeah i know its a weird one.

 

I can copy a paragraph of text but not a lot.

 

Is there any issues posting a textarea box to SQL when it has line breaks etc. These are long paragraphs of text which contain () and "" and the like.

 

Should I be posting it a different way than the other fields?

 

 

Link to comment
Share on other sites

I can copy a paragraph of text but not a lot.

 

Is there any issues posting a textarea box to SQL when it has line breaks etc. These are long paragraphs of text which contain () and "" and the like.

 

Do you escape the text before sending it to the db?

 

$sql = "insert ... " . mysql_real_escape_string($_POST['paragraph']) . " ...";

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...