473,569 Members | 2,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Automatic Submission of Form

196 New Member
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 3289
Atli
5,058 Recognized Expert Expert
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 New Member
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 Recognized Expert Expert
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 New Member
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 Recognized Expert Expert
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 New Member
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
5174
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", "content.txt", None, urllib.urlencode({"aParameter": "theValue"})) Now, the problem is that the above fails, since I am not sending a session cookie....
12
15557
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 the form using VBscript? Terry <% ' ... some asp processing
1
2570
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 an error from the external site. I do not have the code of that site but suppose that my automatic submission does not pass all of the variables....
12
22090
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 the Yahoo/Gmail page. What technology is most appropriate for this kind of work? My current solution is not so satisfying: I download...
6
2834
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. This could be as an attachement or plain text. I wouldn't care if it was like the mailto. I'm clueless on how to do this. Any help would be greatly...
1
439
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 i can fill out a form and submit it automatically by providing only the URL of the form and the txt file? thanks Najla
6
11877
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 clicks again, which created duplicate forcm submission and hence duplicate records. So I am trying to disable the button as soon as it is clicked,...
1
2497
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 short time frame that I've been given, a week to be exact, I do not have the luxury to explore it on my own so here are the requirements: 1. Automate...
5
7334
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 placed this function on my submission button when clicked. <input name="button5" type="button" class="Buttons" id="button5" value="On File"...
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8122
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7673
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1213
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.