Hi!
I'm new to drupal, but i really like it's great features. My problem is with the forms:
How do i build a form, where i can define pre-set variables by php?
I would like to create a submission page, where users can only post an url (imdb url). After they submit the url, my form should preg_match it, to see if it is valid.
If yes, i yould like to search in database to see if this url has been posted or not. If yes, there should be a custom node type with the movies data, so i would like to redirect the user there. If not, then i would like to process the imdb url (curl, get some movie details) and pre-set those on the post node form as custom fields (and maybe as hidden values).
So i would like to do something like this (just for logic, i guess there will be mistakes in the code)
$imdburl=$_POST["imdburl"];
if (!isset($imdburl)) {
#Post your url form here, onsubmit validation with javascript or php
} else {
#connect to db to search for imdb url
if (count($result) != 0) {
#get the node id
#redirect to that node
} else {
include $myphpclass; #curl data fetching
#show drupal form
#and now i will set the default values in form data
#and hide those pre-set data (hidden form)
}
}