473,326 Members | 2,732 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Automatic Submission of Form

196 100+
Ok two questions-

First is it possible to replicate javascripts automatic submit with a php function, i want to do this due to the fact we i run a cron job it wont run javascript.

Second If the above is not possible i need to transfer information from the intial page to another another .php and acts similar to the php form in that when u hit submit it will post the information to the other .php page and then opens that page.

The reason i trying to achieve this is i want a server to run the script with out me having to activate it (i.e. cron jobs).
Sep 11 '08 #1
6 3276
Atli
5,058 Expert 4TB
Hi.

So you are trying to make a cron-job that triggers a local PHP script, which is meant to accept form data?

Why not just create a second page, identical to the original, with the data hard-coded into variables? You could even create default values for the original code, in case the data wasn't passed from the form.

Like:
Expand|Select|Wrap|Line Numbers
  1. ($myField = @$_POST['myField']) or $myField = "Default value";
  2.  
Sep 11 '08 #2
chazzy69
196 100+
Thats sounds like a good idea so how do i post the form automatically to send the data to the second page or just post the varibles i need.


Thanks
Sep 12 '08 #3
Atli
5,058 Expert 4TB
The point of HTML forms is to get data from remote clients to your server. If your scripts are meant to be executed with static data, by the server, there is no need to bother with that, you can simply hard-code the data into the code.

Like, rather than doing:
Expand|Select|Wrap|Line Numbers
  1. # form.html
  2. <form action="action.php" method="post">
  3.   <input type="text" name="field" value="myValue" />
  4. </form>
  5.  
  6. # action.php
  7. mysql_query("INSERT INTO whatever VALUES('{$_POST['field']}')");
  8.  
And executing the "form.html" by a cron-job, you could simply do:
Expand|Select|Wrap|Line Numbers
  1. # action.php
  2. mysql_query("INSERT INTO whatever VALUES('myValue')");
  3.  
And execute the "action.php"

Or better yet, you could do:
Expand|Select|Wrap|Line Numbers
  1. # action.php
  2. ($value = @$_POST['myValue']) or $value = "Default";
  3. mysql_query("INSERT INTO whatever VALUES('$value')");
  4.  
And execute either the "action.php" by a cron-job or the "form.html" via a browser.
Sep 12 '08 #4
chazzy69
196 100+
Just wondering how does the line


[PHP]# action.php[/PHP]


actually work??

I tried this but it didn't seem to do anything, is it ment to execute another .php page???


Thanks for the help
Sep 13 '08 #5
Atli
5,058 Expert 4TB
No that's just a comment.
Was my way of saying that the following code should be in a file called "action.php" :)

It's the same as doing:
Expand|Select|Wrap|Line Numbers
  1. // action.php
  2. or even
  3. /* action.php */
  4.  
Doesn't do anything.
Sep 13 '08 #6
chazzy69
196 100+
I think i worked out how to call another file, using Curl.

Thanks heaps for the input
Sep 14 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Alex Hunsley | last post by:
I'm using urllib to post data to a web form by issuing a command similar to this: filename, headers = urllib.urlretrieve("http://www.thewebsitenamehere.com/servlet/com.blah.bloo.XmlFeed",...
12
by: Terry | last post by:
I'm trying to automatically submit a form to another ASP page after some <input> fields values are filled by ASP. I know I can do it using javascript, but is there a way to automatically submit...
1
by: Piotr Kurpiel | last post by:
Hi, I am creating a site where I need to refer to another external file (aspx). I create the form and works fine. But as soon as I try to submit the form automatically (with form.submit()) I get...
12
by: Stanley | last post by:
Hi, I'd like to write a HTML page which can help me directly log in my Yahoo!mail or Gmail account without typing user name and password. Basically, I want to set up a link, click it and pop up...
6
by: havenoclue | last post by:
I have a database application that is submitted to an Access database. What I want is when the form is submitted to automatically send an email to multiple persons with the info from the form. ...
1
by: grpmangr | last post by:
hi Is ther anyway i can automatically fill out forms and submit them thru java? supposing i hav a normal txt file that contains all data that needs to be filed out into the form, is there anyway...
6
by: Oleg Konovalov | last post by:
Hi, I have a Java/JavaScript GUI application where I perform a lot of long DB operations , which takes 5-60 secs to perform. Sometimes user double-clicks the button or just gets impatient and...
1
by: Homer | last post by:
Hi, I just got a requirement from my HR department to automate their form submission process and integrate it into the Intranet project that I had just completed Phase 1 of. Because of the...
5
by: dmorand | last post by:
I'm having a strange issue with a form I'm developing. I'm saving some values to hidden fields when a user clicks a button. I setup a function which gets ran on submission of the form, but I also...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.