Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

Script Php

Links for php scripts

Moderators: macek, egami, gesf

Script Php

Postby joedenmin » Tue Aug 07, 2012 6:21 am

Hello,
 
I will wish a Php script that allow me to replace a variable from an HTML in another file.
 
<html>
<head>
<title>insertion de données en PHP :: partie 1</title>
</head>
<body>
<table border="0" align="center" cellspacing="2" cellpadding="2">
<tr align="center">
<td>nom</td>
<td><input type="text" name="number"></td>
</tr>

<tr align="center">
<td colspan="2"><input type="submit" value="OK"></td>
</tr>
</table>
</form>
</body>
</html>

Here is my HTML form, I just want when I click Ok the Number field value will be the new value of my variable $ Number = 30; that is in another file conf.php

Do you know how I can do that?
 
Thank you in advance for your help.
cordially
Joe,
joedenmin
New php-forum User
New php-forum User
 
Posts: 3
Joined: Tue Aug 07, 2012 6:16 am

Re: Script Php

Postby freshnet » Tue Aug 07, 2012 10:46 am

You'd have to do this in a php page, not an html page. Just replace the value you want with something like
Code: Select all
<?php include 'conf.php'; echo $Number; ?>
User avatar
freshnet
php-forum Active User
php-forum Active User
 
Posts: 277
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Re: Script Php

Postby joedenmin » Thu Aug 09, 2012 9:00 am

It does not work,
the variable does not take the value we assign

Here is my conf.php



<?php

/*

=========================================================================

General settings for language and database

=========================================================================

*/


$number = $_POST["number"];
echo($number );


define("MAILQUEUE_BATCH_SIZE",$number);



?>
joedenmin
New php-forum User
New php-forum User
 
Posts: 3
Joined: Tue Aug 07, 2012 6:16 am

Re: Script Php

Postby freshnet » Fri Aug 10, 2012 6:41 am

You're calling a $_POST variable in the conf.php page, but you're not posting anything to the new page. You will need to create a form in the first page, use the post method and post it to the conf.php page.
User avatar
freshnet
php-forum Active User
php-forum Active User
 
Posts: 277
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Re: Script Php

Postby joedenmin » Sat Aug 11, 2012 7:25 am

Hi,


I added <form action="conf.php" method="post"> in html from but still not working

It does not work,
the variable does not take the value we assign


Regards,
joedenmin
New php-forum User
New php-forum User
 
Posts: 3
Joined: Tue Aug 07, 2012 6:16 am

Re: Script Php

Postby freshnet » Mon Aug 13, 2012 3:17 am

post the whole of the code you have now, including the html from the first page.
User avatar
freshnet
php-forum Active User
php-forum Active User
 
Posts: 277
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Re: Script Php

Postby Aileefaria » Sun Aug 26, 2012 10:20 pm

Thanks for taking the time to share your view with us.You seem to be more practicable! keep up the good work! ,I've gain more knowledge and good information from your post thanks.
Aileefaria
New php-forum User
New php-forum User
 
Posts: 2
Joined: Mon Jul 30, 2012 10:25 pm

Re: Script Php

Postby sivakami » Tue Sep 04, 2012 11:59 pm

yes
sivakami
New php-forum User
New php-forum User
 
Posts: 17
Joined: Tue Sep 04, 2012 11:26 pm


Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron